Archive for March 27, 2006

Object Thinking - Object Redefined

The first rule that you need to follow before you dive deep into OOP, is to fist understand how objects work in the real world. Lets go through it again. What is the definition of an object? I mean a physical object in the real world, say you might have learnt or could refer books or get the definition from net. I am sure you would find the words attribute, behavior, characteristics, operations and related words wherever you search for. Lets go by that definition first. Here is a simple definition that I pulled out from the result of a google “define:object search”.

In object-oriented design or programming, a concrete realization of a class that consists of data and the operations associated with that data.

If you had seen my post titled “Object Thinking - Thinking Objects”, you would have realized that these attributes and behavior are well defined and has a definitive scope (remember you cannot light a gas stove using a vessel or cup). But think about this, a well defined object is as equivalent to a stone sitting in the north pole. Every object needs a message to act. Yes you heard it right, objects can hear and act just like how you would when somebody talks to you. You act upon the objects by passing a message.

Take the same coffee example, just by keeping all the objects around, you wont get coffee, come on be serious. Remember the chain reaction, yes you started it and was there to pass on the message whenever and wherever required. So what happens when you pass on a message, the object reacts and changes its state (a state is value change in the object’s attribute). You strike the match stick against the match box and bingo there you have the flame, so the match stick’s state changed from being just a match stick to a match stick with its head on flame. Flame is passed on to the gas stove, the heat message is passed on to the vessel and it passes it to the milk, result is the milk’s temperature state changes. Wow, isn’t that cool? Did you ever think about it?

So aren’t we missing something drastic from the definition of an object to just being attribute and character/behavior. Let’s redefine it. An object is a well defined set of attributes with behavior or characteristics with the ability to react to a message and change its state. How does that sound? Now start looking at all the exercises you did in collecting objects and scenarious from the “Object Thinking - Thinking Objects” post exercise and analyze them, what message is passed and what state gets changed in each object.

Blink this Object Thinking - Object Redefined at blinklist.com    Bookmark Object Thinking - Object Redefined at blogmarks    Bookmark Object Thinking - Object Redefined at del.icio.us    Digg Object Thinking - Object Redefined at Digg.com    Fark Object Thinking - Object Redefined at Fark.com    Bookmark Object Thinking - Object Redefined at Furl.net    Bookmark Object Thinking - Object Redefined at NewsVine    Bookmark Object Thinking - Object Redefined at reddit.com    Bookmark Object Thinking - Object Redefined at Simpy.com    Bookmark Object Thinking - Object Redefined at Spurl.net    Bookmark Object Thinking - Object Redefined with wists    Bookmark Object Thinking - Object Redefined at YahooMyWeb

Comments      Cosmos


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.