Avoiding Object Oriented Pitfalls, Migrating from C, What Worked for You?

Posted by Stephen on Programmers See other posts from Programmers or by Stephen
Published on 2011-06-21T02:45:00Z Indexed on 2011/06/21 8:30 UTC
Read the original article Hit count: 292

Filed under:
|
|

I've been programming in procedural languages for quite some time now, and my first reaction to a problem is to start breaking it down into tasks to perform rather than to consider the different entities (objects) that exist and their relationships.

I have had a university course in OOP, and understand the fundamentals of encapsulation, data abstraction, polymorphism, modularity and inheritance.

I read Learning to think in the Object Oriented Way and Learning object oriented thinking, and will be looking at some of the books pointed to in those answers.

I think that several of my medium to large sized projects will benefit from effective use of OOP but as a novice I would like to avoid time consuming, common errors.

Based on your experiences, what are these pitfalls and what are reasonable ways around them? If you could explain why they are pitfalls, and how your suggestion is effective in addressing the issue it'd be appreciated.

I'm thinking along the lines of something like "Is it common to have a fair number of observer and modifier methods and use private variables or are there techniques for consolidating/reducing them?"

I'm not worried about using C++ as a pure OO language, if there are good reasons to mix methods. (Reminiscent of the reasons to use GOTOs, albeit sparingly.)

Thank you!

© Programmers or respective owner

Related posts about c++

Related posts about object-oriented