|
Re: Teaching OO: Putting the Object back into OOD
|
Posted: Sep 18, 2003 11:46 AM
|
|
Loved the article. I've come to many of the same conclusions over the years since 1986 when I first was exposed to OO development via Smalltalk.
It is nice to see the we are going back to the basics with this discussion of what we are really modeling. Instances and what roles they play at different times in their lifetimes. When viewed from different perspectives, they can be seen as class descriptions, role players, components, collaborators, function implementations, etc. Some are data centric, some are behavioral, some are controllers, some are monitors, etc. All are roles,... yet each has some state, may exist in a class heirarchy, or delegate cluster, etc.
Knowing all that, I like to recommend people learn a fully dynamic language and also a prototypical OO language as well. With that, we can create prototypes that play these roles, work together to implement the required functions and then later on cluster them in to classes and heirarchies. It also lets them model their systems in code exactly like you would do with the CRC instance you mention you hold up in the air.
When I teach design, I also focus my students on composition of instances and on Collaborations diagrams. I do that to stress instances and that the objects are working together and the roles they play. I find that that steers them towards better solutions than focusing on class diagrams and sequence diagrams.
It is also at this point that I find some students want to talk about those roles and interfaces, how they relate and do they relate to class vs. type issues. This also helps to clarify the idea that a role isn't a class and that interfaces are not types either. We then can discuse type vs. role. Type being a structural idea and roles being a behavioral idea. One example that may be given is that a man is a type of mammal, but a man plays a role of a cop at work and dad at home. His genetic structure doesn't change to be a different type, but his role does change in those different situations.
Anyway, to all who've posted before this and to James and Trygve thanks for the great reads in your books and papers and now this weblog.
|
|