This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I just wanted to comment on how background affects the way you approach objects.
My interest in ecology and ecological modeling made it very easy to pick up computing with objects. Biology is full of hierarchical concepts and object orientation in ecological simulation is a good fit. Of course, Simula, the first object oriented language was created for simulation of complex systems.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Howard T. Odum had a major influence on ecological system simulation with his energy flow diagramming.
Entities in these diagrams illustrate OOP principles - they hide the internal details and provide specified inputs and outputs. Furthermore, and relevant to OOP in general, an Odum diagram provides something you can point to and explain when discussing the system to non-ecologists (non-programmers). We used them in environmental impact studies for that very reason.
Joined: May 01, 2013
I am not sure that this is exactly what you are looking for, but you can use a hierarchy of birds. When you ask people to describe the most common behavior of birds almost everyone would say 'flight". However, not all birds fly. So you would have to decide if you want to create a Bird class that doesn't include a "flight" method. Perhaps you would need 2 classes, FlyingBirds and FlightLessBirds that inherits from the Bird class. There really is no right or wrong way to handle the design - it just makes for interesting discussions. Not all dogs can bark either.
Some goats scream like humans... it's freaky funny. Seriously though, while relating real-world concepts to OO designs can produce some very natural relationships, there are also pitfalls that you need to avoid. The classic example being A Square is not a Rectangle. I saw that there are sections in the book about Composition and Inheritance and how Inheritance weakens encapsulation.
The tree of life keeps getting restructured/reorganized as scientists discover new relationships between organisms and move the leaves and branches around. A class-based OOP approach is not as flexible in this case. Perhaps the prototype-based OOP approach is more suited in this case?