Earlier it was observed that OO paradigm deals with the problem domain and hence a OO design quickly realigns itself if the problem statement changes. How is it done? A OO design achieves it by trying to readily model the real world (as opposed to modeling a solution in the traditional approach) in a given context. This is largely true, but not strictly. A OO design is not the exact replica of the real world (There is a lot of published material on this subject available on the Internet). The reason for this is easy to see. In any application, of course, there are classes corresponding to real-world objects; but they are often out-numbered by implementation classes which may not have readily identifiable real world counter-parts. Examples are boundary classes, an encryption algorithm, etc.
This is not about those implementation classes. It is about the classes modeling the real-world objects. Even with these real-world objects, one ends up with a less optimal design if the classes model them with great fidelity. The breaking away of the OO design from the true real-world objects can be nailed to the basic OO tenet that the objects in OO design need to be empowered as much as possible and as uniformly as allowed by the context (Skew in empowerment will be the subject of another blog). The real-world problem comprises live objects as well as inanimate objects. While the live objects ‘behave’, the inanimate objects have very limited or no behavior at all. Whereas in OO design, even inanimate objects are invested with interesting behaviors as part of empowerment.
For example, consider a Library application. Here, in real-world, one picks up the book from the shelves (or looks up in the electronic catalog). The book is taken to a counter where a library person (or an electronic agent) issues the book after recording the transaction. In the OO design, the responsibility of issuing the book is shifted to the book object itself: ‘the book issues itself’. This is how different objects are empowered to the full. How do we explain this? If the book object was animated in real, perhaps it would behave this way. It would not need a real object (the library person) to get issued! Similarly, an invoice (object) can print itself without anyone’s help or intervention!