Prev: Ruby WARC Parser
Next: RUBY_VERSION_* macros in C?
From: Colin Bartlett on 11 Jul 2010 13:19 On Fri, Jul 9, 2010 at 10:15 PM, Robert Klemme <shortcutter(a)googlemail.com>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, this > 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-oop 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 programming 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 object-oriented languages. The various versions of Smalltalk all shared this model, although 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 was 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, its been a popular misconception that the better known Simula-67 was his real influence, when Smalltalk and Simula actually evolved independently. Kays term object-oriented got hijacked when Peter Wegner published paper entitled Dimensions of Object Based Language Design at the second OOPSLA conference in which he defined object-oriented as objects + classes + inheritance. http://www.smalltalk.org/smalltalk/TheEarlyHistoryOfSmalltalk_Abstract.html ...
From: Rick DeNatale on 11 Jul 2010 15:04
On Sun, Jul 11, 2010 at 1:19 PM, Colin Bartlett <colinb2r(a)googlemail.com> wrote: > Kays term object-oriented got hijacked when Peter Wegner published paper > entitled Dimensions of Object Based Language Design at the second OOPSLA > conference in which he defined object-oriented as objects + classes + > inheritance. > http://www.smalltalk.org/smalltalk/TheEarlyHistoryOfSmalltalk_Abstract.html Thanks for the mention Colin. Recently, one of Wegner's students, William Cook, drafted a paper http://userweb.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf which points out what was missed back in the 1980s, that there is a vast difference between Abstract Data Types and Objects, something which I'd argue caused a lot of confusion over the past 25 or so years. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale |