3 ms·
How can I develop an intuition about good OO design? ... Seriously though, what open source code or books would you recommend? A lot of people have suggested d
by Chris_Newton 14y ago
How can I develop an intuition about good OO design? ... Seriously though, what open source code or books would you recommend?
A lot of people have suggested different perspectives over the years, and if you want to develop a feeling for when and how to use OO, I would recommend exploring as many of those different points of view as you can.
For example, here are some comments by Alan Kay on his view of OO, which emphasize the message passing and late binding ideas:
http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...
You might also be interested to read about the original model-view-controller (MVC) idea as used in Smalltalk, which is like a textbook case study of some of Kay’s OO ideas in practice. (Don’t confuse this with modern Web frameworks that use the term MVC but aren’t quite the same thing.)
For a somewhat different view, perhaps more “heavy industrial” OO in spirit, you could read Grady Booch’s book Object-Oriented Analysis and Design with Applications.
As general knowledge, you could also read Design Patterns and some of Robert C. Martin’s early work on the “SOLID” principles. Then read some criticisms and retrospectives of these works for a counterpoint.
For practical thoughts, I suggest reading books like Scott Meyers’ Effective C++ and Joshua Bloch’s Effective Java. Even if you don’t use those specific programming languages, there are a lot of comments about what works in practice with the kind of OO tools are available in that family of languages. Stroustrup has some interesting comments about use of objects and the role they can play in a language that isn’t purely OO in The C++ Programming Language, though it’s only a relatively small part of a large book.
Likewise, you could try to read about using objects/OO in dynamic languages like Ruby and Python, and about JavaScript, where the flavour of OO is different again. I don’t have specific sources I’d recommend as obvious starting points here, but these languages tend to be discussed a lot more often in on-line forums recently because of the high profile of Web work at the moment.
I’d also recommend studying API design, since a lot of the comments and examples in books or conference talks about this area tend to use OO by default for their case studies. The most interesting single source I’ve come across in this area was a lecture given by Casey Muratori:
http://mollyrocket.com/9438 http://mollyrocket.com/9438
Ultimately I don’t think there’s any substitute for experience or discussing real programming situations with colleagues, but if you start from some of the ideas above hopefully you’ll develop some kind of frame of reference and a pool of ideas you can draw on in your own work.