How to get started with object-oriented programmind

From ArticleWorld


Object Oriented Programming (OOP) is one of the most widely used programming paradigms of the moment. It is especially preffered for large programming projects, where various pieces of code need to be re-used at times, and it is becoming (if it was not already established) as a fundamental skill a programmer needs to master.

Getting started with this paradigm is never easy though, maybe due to the large number of new concepts that have to be learned. Nevertheless, the steps you can find below may be a good outline to follow. Do expect to need a few weeks to fully understand all the concepts and be productive with OOP, but also expect it to pay off.

How to

  1. Pick a language. If you already know a language with object-oriented capabilities, like C++ (or even its subset, C, though it is not object-oriented), Python or Ruby, you need not learn another. Otherwise, you may need to learn one. C++ and Java are the most popular, though Delphi, Python, Ruby and Objective-C are also used (in fact, Objective-C is the standard language on Apple's OS X)
  2. Start with the basic elements. There are three basic concepts you need to master entirely: inheritance, encapsulation and polymorphism. If you know these, your way is assured. Only after you have mastered these concepts and can apply them in practice should you move to more advanced, language-dependent components like virtual classes and constructors, delegates or multiple inheritance.
  3. Develop an object-oriented thinking. Some languages may be rather bad at this (C++ is actualy notorious for not explicitely using message passing, but rather method calling). Try to look around yourself and, as an exercise, "emulate" various tools, like microwave ovens or TV sets. Exercise your concepts.
  4. Write an entire (maybe somewhat useful) application in an object-oriented fashion. Or, even better, try to port an older program you already wrote in a procedural language. This will make it easier for you to see advantages, disadvantages and things to learn.

Notes

It is very important that you already master procedural language before going to OOP. OOP, while providing a different organization paradigm, does not magically provide a new way to program. You will be organizing procedural pieces of code, rather than write completely different programs.