|The Object-Oriented Thought Process (5e)|
|Written by Mike James|
Author: Matt Weisfeld
Getting inside the object-oriented thought process is a trick worth knowing. Does this book hack it?
If you haven't really caught on to the idea of objects then perhaps this book might have things to tell you, but it is difficult to see how you could avoid learning at least a little about objects if you can program. There are so few languages that aren't object-oriented you are bound to have picked up at least the idea of class and object. More likely is the situation where you know about objects, but aren't 100% clear of the theory behind it all. The fifth edition states that it has been updated to take account of the fact most current readers would know something about objects, but it still starts from scratch.
Chapter 1 provides us with the basic idea of an object. I didn't find the approach satisfying as it tells you what an object is and what the benefits are, but it doesn't really give you any deeper idea of how the idea arises naturally as an extension of a structure. It also starts to throw in lots of other ideas, which are additional to the basic idea of an object - such as class, messages, gettters and setters, inheritance, polymorphism and so on. Some of these ideas are just one particular way of doing objects rather than part of the "way to think about objects". Even in this first chapter you can see the shadow of Java and C++.
Chapter 2 claims to be about "How to Think in Terms of Objects". It uses the term "interface" to mean the object's public methods which is unfortunate because the term often refers to something else. Basically this chapter says that an object is its public interface and this allows you to forget about implementation details.
Chapter 3 is on advanced topics, but they are a very narrow selection from the standard object-oriented languages rather than being deep theory. It starts off with the idea of a constructor - which may be part of the popular object-oriented languages, but isn't the only way to do the job. We also have an introduction to UML, exception handling, scope, static attributes, operator overloading and references.
Chapter 7 tackles the inheritance and composition problem. It basically says that inheritance isn't as good as you might think because it breaks encapsulation. This is partly true, in that it is all too easy to build complex inheritance hierarchies that can be sensitive to small changes made at the top of the hierarchy. What would be good would be an example of this in action - but as in so many chapters the evidence isn't presented and the "if you want to know more read another book" attitude prevails. There is also no mention of the vague way that function overriding works and how it too can break a fundamental principle of OOP - the substitution principle.
Chapter 8 complicates the picture with a consideration of the Interface and the Abstract class. Chapter 9 discusses aggregation and association. Chapter 10 describes the classical design patterns, but it is far too short for a big topic. Chapter 11 is another meditation on inheritance and composition, but with coupling and dependency at the fore. The final chapter is on SOLID and has, at last, a good account of the Liskov substitution principle.
Most of the examples in the book are in Java or C# and essentially the book is talking about object-oriented programming as implemented in these two, similar, languages. Don't bother even trying to read this book if you don't program in a language of this type. This is a book aimed at beginners, but not at non-programmers.
There are also lots of really important topics and ideas that are simply not discussed in any great detail - type hierarchy, covariance, contravariance, generics with type parameters, and so on. And why no explanation of why polymorphism is a way of avoiding conditionals? And nothing at all about the way objects evolve from data structures.
This is supposed to be about object-oriented thinking, but it doesn't get deep enough to explain how it works. At best it is a standard account of the top-level principles of class-based, object-oriented programming - encapsulation, inheritance, composition and polymorphism - as seen from the perspective of a Java-like language.
If this is what you want to know about then perhaps you will get something out of this book - but reading the standard documentation is likely to get you just as far. If you are looking for an in-depth and reflective discussion of object-oriented programming in all its forms then you need a very different book.
|Last Updated ( Tuesday, 24 March 2020 )|