Remember you are a class not an object
View From: Prabhakar Karve
Last updated: 10-3-2010
Other Views by this Author:
When the concepts of object oriented programming are applied to life in general we see some interesting outcomes
Each of us exists as an object amongst innumerable other objects in the cosmic OO space. We are created and destroyed by some other object. We inherit our behavior (methods) and properties (instance variables) from our parents (super) and forefathers (other classes in the inheritance chain).
In early childhood, we are aware of ourselves only when one of the objects which is close to us (has reference to us) triggers certain predefined behavior (calls a method). Our response is preprogrammed (by the class of which we are an object), but the result depends on the behavior of others (method arguments). Once those around us understand how we respond, they start teaching us (set our instance variables) so that they can get desired response from us. We in turn start calling methods on others around us (other objects) and learn what works and what does not. It gets stored in our memory (instance variables) which we can use next time we interact with others.
Some learn fast while others take time. It varies from individual to individual (type and variety of instance variables and intelligence built into the setter methods). Some are gifted (instance variables set when the object was initialized) while a few others may have inherent defects (lack of essential variables or poorly defined setter methods) and continue to struggle being labeled as mentally retarded.
Some of us are born shy and introvert while others find it easy to reach out and are extroverts. Degree to which we yearn to share or feel safe to share with others differs from person to person (private, protected and public scope). We may be also reluctant to share our inner feeling and true behavior and hence live behind a mask (getter methods).
As we grow, we continue on this journey of constantly interacting with variety of people (objects) or situations (contexts), patterns are observed and get stored in our memory for future use. This is what we call experience. However, each of us may form different patterns though going through same set of interactions. How much importance we give to past experience and how much to what is happening now again varies from individual to individual and depends on our makeup (what our class has defined for us).
We continue on this journey throughout our life, reacting to situations, storing pleasant / unpleasant experiences and allowing ourselves to be manipulated by others because we perceive ourselves and feel attached to the object. This leads to emotions like greed, anger, blind attachments and so on.
However, the class of which we are the object lives its own life, responding to others at its own level (class methods & class variables). One major difference compared to its object is that the class not only reacts but can proactively act. It is aware of its object and can re-factor and dynamically create /modify / destroy instance methods and variables as well as their scope based on what it observes. Though the class is bound by what it inherits, it has power to implement new interfaces (like Java) or mix new modules (like Ruby). It loves its object but does not feel attached to it.
Our journey on the path of self awareness starts only when we become aware of our class. Initially, we are still strongly attached to the object and feel helpless when faced with adverse situations. However, as our awareness of being the class becomes stronger, the picture becomes clearer and though we are aware of all that is happening to us as an object, our attachment to the object starts diminishing. We feel more confident, more in control and less dependent on others approval. The result is emotions like greed, anger, blind attachments and so on slowly start melting away.
If we believe in rebirth, we become aware of the fact that we are a singleton class. There can be only one object at a time. The object may eventually be destroyed but the class continues. When the object goes away, the state attached to it also gets destroyed and eventually garbage collected but the definition and state of the class persists and will be the basis when next object is created.
Though the object may not be, but the class is aware of its inheritance tree going right up to the topmost class from which all other classes are derived. It has a direct connection (inner voice) with other classes through the inheritance tree including the original class. When we are aware of this, we have the power to make use of this immense resource and get an answer for any problem. The uncertainty and dilemma when faced with a tough decision vanishes and we are at peace.
When we have this object oriented understanding of our existence, our answer to the eternal question “Who am I?” will spontaneously be that “I am a class; I am fully aware of and love my object but I am not the object”. Enjoy