What are the Cornerstones of Object Oriented Programming?
What makes a language Object Oriented?
The benefits of Object Oriented programming are undeniable. The tenants of OO are pervasive in modern languages, both dynamic and compiled languages. In fact, whether you realize it or not, if you are programming today, you are more than likely, using Object Oriented programming. According to Booch an Object Oriented language consists of the following:
Of course, you could add many more bullets to this list but these four are the focus of this post.
As you can see from the above list pretty much every modern language supports one or all of these tenants. Given that these principles are inherent, why then, is the obvious value of Object Oriented programming so elusive? I personally think, and you may agree, that the answer is simply a sign of the times. Today, every thing is abstracted away from us and that includes, to a certain extent, Object Oriented principles. For example, when we use XSD.exe to create a client proxy in C# we just take for granted, the classes that are ultimately generated as the end result, will work - and, well they do. The questions should be asked why do they work and how do they work? Most of us do not study the results of XSD.exe to see what Object Oriented principles can be found there. Hey, it works and that's good enough, right?
I'm not saying you are a slacker if you don't inspect the result of XSD.exe. Who really has the time anyway? I'm saying find the time to inspect the results of all tools that provide code generation to ensure that you understand, at least at a high-level, what the hell is going on under the covers. Sometimes you will find that these tools can actually be making your life harder in the long run. Save, for a very few tools, I tend to avoid "automagically" like the plague. That's the control freak in me.
Don't get me wrong, I am not advocating circumventing the wonderful tools that make these kinds of repetitive tasks obsolete or negatively criticizing them in anyway. I am merely advocating that we take a look, every once in a while, and understand what it is that is going on down in the muck and mire. If we do this, odds are other aspects of our programming will benefit from our understanding of this code. Apart from the tenants of Object Oriented programming found in these generated bits of code, we will see other forces at work such as solid Design Patterns.