What Is an Object?
by, 04-26-2012 at 05:30 PM (533 Views)
Key to understand the objects oriented technology are objects. Look around & many examples would be present of real world objects, for example your desk, your bicycle, your dog, your television set etc.
Two characteristics are present in real world objects. Behavior and state are present in all of them. Dogs have behavior (fetching, barking, wagging tail) & state (breed,hungry, color,name). Bicycles also consist of behavior (applying breaks, changing gears, changing pedal cadence) and state (current pedal cadence, current gear, and current speed). Identification of the behavior & state for real world objects is one of the greater way out to start thinking regarding the object oriented programming.
See real world objects present around you and observe them for a minute. Two questions shall arise in your mind by seeing every object. First one is that what could be the possible states of the objects? & what behaviors could be performed by the object? Ensure writing down the observations. By observing them you will come to know that real world objects are varying in their complexity. Desktop lamp consists of 2 possible behaviors & 2 possible states but desktop radio consists of certain additional behaviors (Increase volume, turn off, decrease volume, turn on, seek, tune and scan) & states (on, off, current station, current volume). One might also notice it that certain object also consists of other objects. Such observations of real world would be translating to the object oriented programming.