October 25, 2004

Object Oriented ... Friendships

I am an object orientation (OO) freak. OO allows to model your program like real life, which makes programming a bit more natural.The few programs that I do write, are invariably OO. Sometimes, I feel my fascination for OO does more harm to my programs than good.

Anyway, the basic funda of OO is that your project is split up into objects. These objects strictly mind their own business - they dont, and shouldn't, interfere with other objects in the program. If an object 'A' deals with an object 'B', it has no business knowing what 'B' does with another object 'C'. Each object has it's own set of public 'methods' which is known to every other object, and some private data that NO ONE is allowed to see. As long as the objects retain their 'public' appearance, everyone in the project is happy, and life goes on smoothly. Internally, each object may undergo various changes, new private properties may be added, some removed, but what matters is the methods they expose.

This is supposed to model the real world, but I guess the real world could learn something from all this. Just replace the word 'project' with life, and 'object' with 'friend' ...

Just my two cents worth ...

No comments: