Learning Object Oriented Programming

How does one go about learning ObjectOriented design and programming? Practice is clearly helpful, but some learning before practice would be helpful as well. DesignPatterns is clearly a good book, but is not really for beginners. What book or books should someone new to ObjectOrientedDesign read first?

Mine, when I finish it - don't hold your breath. It's hard to recommend a book these days. Most of the programming books from the last few years are designed to teach people enough Java to hack out e-commerce sites. I started my book in deep disgust after looking at the "programming" section in Blackwells. The worthies are there, of course, like Knuth - but the rest! I must be able to do better than the extra-wide-margin, crazy typography-around-the-page-number, three-inches-and-a-CD brigade. So I'm having a go.

Many of the OO books around that are any good are at least a few years old and tend to be quite advanced (ie, they require the reader to think while reading them - never a popular approach).

There are lots of OO related pages on Wiki scattered around. Is it possible to construct a roadmap based on what is here already? In a manner suitable for OO learners.

If the pages are categorized properly the contents can be refactored in an organized way.

We are increasingly using Java, and we have a number of programmers who we would like to retrain to use Java. Most currently use PL/SQL and COBOL. We have found that the Java syntax is not the major problem, but learning the object-oriented way of thinking. Most of these programmers were originally taught that separation of data and code is the HolyGrail. Some see the encapsulation of data and methods in an object as evil.

Of course, only a few express this extreme view. Many want to work in an object environment but just don't seem to get it. They typically produce designs with some objects that are primarily data (sometimes with getter/setter methods), and other objects that are really just containers for methods to work on the data objects.

Can anyone recommend any books/training that is specifically suited to people who have grown up with the SeparationOfDataAndCode methodology?

StructureAndInterpretationOfComputerPrograms is probably the best. If I understand the LISP way correctly, data/code distinctions are anathema.

I've found the RefactoringImprovingTheDesignOfExistingCode book really useful with former C programmers we have on our team. It's really good for showing them how to move from Data objects and objects which are just really Collections of Methods into proper self contained classes. The bits on FeatureEnvy in particular are very good at getting across what OO is all about.

-- SteveEyles

In order to wean a programmer off one programming discipline/approach and onto another, it might be useful to get going a discussion about the relative merits/pitfalls of the competing disciplines.

For instance, why is one discipline better than the other? What are/were the motivations for each? What does one accomplish that the other does not, and so on?

(Discussion moved to GateKeeper)

It would be nice if there were a book brave enough to tackle that. Bertrand Meyer allegedly made such an attempt (see below).

Can the original poster tell us what procedural languages he is using now?

Smalltalk is the language one should NOT touch when learning OO. After learning Smalltalk, you might hate C++/Java/.., whatever language you're actually using, with passion. Especially if you do learn OO. :)

When working with programmers that may be new to OO concepts, I've found that it helps to focus them on what I consider the two pillars of Object Oriented practice: DelegationPattern and SwappingClassesAtRuntime, and on what they are trying to achieve, mainly, applications that remain maintainable and adaptable as they grow in size. I think that n-tier, DesignPatterns, and the general benefits delivered by OO trace back to these two techniques.

I start programmers with basic examples of encapsulation, inheritance, and polymorphism, but I like to move very quickly to practical application. It's important to me that they DoItBecauseItMakesSense?, rather than DoItBecauseYoureSupposedTo?. Otherwise, you wind up with programmers who want to misuse design patterns, argue about why VisualBasic 6 is not Object Oriented, avoid globals because "globals are bad," create strange and wonderful inheritance hierarchies, etc. Just like we used to do, right? :)

-- JoelRosenberger

Being fairly self-taught at OOP (which probably explains my unusual view of it), I would recommend to practice/experiment in the following order:

The difficulty of designing OOP programs might seem an argument against it, but that would be too harsh. The problem is mainly down to OOP currently only having (usually single) inheritance to incrementally express larger problems, and it is this that requires expertise to avoid being misused.

You can write some pretty good OOP stuff without inheritance, and it fits well with ExtremeProgramming to only refactor single classes into a class hierarchy when it becomes obvious that this would be a good idea. You then no longer need the huge experience required to to design an OOP hierarchy correctly in the first place, but instead only need to be good at spotting (after the fact) when such hierarchy would be helpful...

-- ChrisHandley

Perhaps one should read LimitsOfHierarchies to understand some of the pitfalls and difficulties of hierarchies and identify these sticky situations when encountered.


I think the above merits a page as there are practical considerations for ApplicationProgrammer?. I got alerted to it in an article that discussed compatibility concerns between releases of an architectural framework. In it there was caution about the fragility of the serialized object.

Subsequently I did a search on C2 and problems are talked about in bits and pieces in many places. If we have a page like the suggested name above then platform specific discussions can be linked together.

Anybody able to start a page to educate old-timers that have missed out on object technologies?

See ObjectOrientedProgramming, PeopleWhoDontGetOo, BoyThisStuffMakesMeFeelStupid

EditText of this page (last edited January 21, 2007) or FindPage with title or text search