From: Colin Bartlett Date: 2010-07-12T02:19:15+09:00 Subject: Re: from functions to classes, where should I start? --0016368333a4a7b73f048b1fd5eb Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Fri, Jul 9, 2010 at 10:15 PM, Robert Klemme wrote: > On 09.07.2010 19:11, Jay wrote: > >> ... >> Here are some of the most common reasons to consider OOP: >> >> 1) Making state information handy to the functions that need it. >> If you find yourself passing the same data in as parameters to related >> functions, then consider wrapping the data and functions up into a >> class. >> > The key word for this is "encapsulation". I believe it is the most > important aspect of OO. > > ... >> > I think this is normally named "information hiding". I use it even for > smaller scripts. > > 3) Use of inheritance or polymorphism >> If you want to benefit from subclassing objects. >> > IMHO inheritance is overrated (or maybe overused). Often people turn to > inheritance where composition would be a better choice. But I agree, thi= s > is another important aspect of OO. > There are (at least) two interesting posts on this on Rick Denatale's Talk Like A Duck, in which (amongst other things) Rick quotes Alan Kay: http://talklikeaduck.denhaven2.com/2008/01/01/alan-kay-on-the-meaning-of-oo= p I've written before in this blog about how the meaning of the term "object-oriented programming" got hijacked from it's original meaning. For example I go into this in some length in my mini-memoirs. [*see link below*= ] I recently ran into an interesting site with links to "Classical Computer Science Texts", which in turn led me to this e-mail exchange with Alan Kay on the meaning of OOP from July of 2003. This exchange gives support, with details, for my description of Kay's concept of what Object-Oriented Programming was supposed to mean. http://www.purl.org/stefan_ram/pub/doc_kay_oop_en http://talklikeaduck.denhaven2.com/articles/2006/07/29/about-me ... One of the things which always attracted me to Smalltalk was that it placed encapsulation above all else. As Alan Kay noted in his memoir about the origins of Smalltalk, his original conception of object-oriented programmin= g was that software should be composed of objects which were, in effect, little computers themselves, which encapsulated both data and behavior, and hid the implementation of both from other objects, with objects interacting via sending messages to each other and replying. This uniform object model separates languages like Smalltalk and Ruby from other =93object-oriented= =94 languages. The various versions of Smalltalk all shared this model, althoug= h they varied as to some of the semantics of message sending and reception. The idea of classes and inheritance as a way of factoring implementation wa= s actually a rather late addition to Smalltalk. Although Kay acknowledges the Simula language, which also lacked classes and inheritance, as one of the influences on his thinking leading up to Smalltalk, it=92s been a popular misconception that the better known Simula-67 was his real influence, when Smalltalk and Simula actually evolved independently. Kay=92s term =93object-oriented=94 got hijacked when Peter Wegner published= paper entitled =93Dimensions of Object Based Language Design=94 at the second OOP= SLA conference in which he defined =93object-oriented=94 as =93objects + classe= s + inheritance.=94 http://www.smalltalk.org/smalltalk/TheEarlyHistoryOfSmalltalk_Abstract.html ... --0016368333a4a7b73f048b1fd5eb--