Do you understand what encapsulation means, but don’t know why in the world you would want to use it?
 
Do you see examples of inheritance in the frameworks and libraries, but have only just dabbled with inheritance in your own code?
 
If you answered yes to these questions, you want to begin to learn the patterns literature.

Object oriented programming gives you the tools, but doesn’t tell you how to effectively use them. 

We all just rummage in the dark sometimes, but after a while, some techniques started showing up over and over.  A few years back, a group of clever researchers decided to ask some of the best developers using OO languages what solutions they were coming up with.  If a solution tended to appear over and over, the researchers wrote it down, gave it a name, and described when it would be good to use.

These recurring solutions are called “design patterns.”

The landmark book that opened up design patterns to the world is called”Design Patterns, Elements of Reusable Object Oriented Software” by Gamma,Helms, Johnson, and Vlissides (a.k.a. the Gang of Four).

This book is an excellent reference, but not an easy read.  I do not recommend that you start there.  I recommend, instead, that you start with a slim and readable volume called”Design Patterns Explained” by Shalloway and Trott

These are not code snippets per se, although many books illustrate their examples using bits of code, and I’ve seen at least one patterns book come with a CD illustrating samples of each pattern (Design patterns in C# byCooper).   Design patterns are not libraries, either.  They are techniques and solutions to the problem of learning and understanding Object Oriented programming.

Take a look at the Shalloway book.  If you aren’t a better programmer after reading that book, I’ll eat my hat. (I read it in two days… it’s an easy read)

A list of useful books in the patterns space can be found here:

http://www.amazon.com/exec/obidos/tg/listmania/list-browse/-/2U7CN56RFJYU3/ref=cm_aya_av.lm_more/104-0692560-9975161

Good Luck

(this blog posting was copied from my prior blog.  I find myself referring to it in the forums from time to time, so I wanted to keep it around.)

By Nick Malik

Former CIO and present Strategic Architect, Nick Malik is a Seattle based business and technology advisor with over 30 years of professional experience in management, systems, and technology. He is the co-author of the influential paper "Perspectives on Enterprise Architecture" with Dr. Brian Cameron that effectively defined modern Enterprise Architecture practices, and he is frequent speaker at public gatherings on Enterprise Architecture and related topics. He coauthored a book on Visual Storytelling with Martin Sykes and Mark West titled "Stories That Move Mountains".

3 thoughts on “How to learn Object Oriented Programming”
  1. The Gang of Four book is an impossible read for someone who has no OOP experience.

    Coopers C# Design Patterns is easier to learn from and the introduction to C#.Net in the early chapters is a great jump start for those who come from the VB6 world.

    The best introductory book to design patterns I have seen so far, and the one that finally lit the little bulb for me is Head First Design Patterns from O’Reilley press. It’s Java based

    but so clear and easy to understand that it’s not a problem to translate the concepts to any other OOP enabled language one might use.

  2. Thanks for the contribution.

    I do think that Shalloway (see above) is a better intro to OOP than Coopers, simply because he goes into detail explaining "why" and not just "how."

    I didn’t know much about the Head First book, so thanks for the pointer.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + nine =

This site uses Akismet to reduce spam. Learn how your comment data is processed.