Today we will make a entry into the world of Object Oriented Programming (We will call it as OOPs henceforth)
Whenever people discuss anything seriously about Software & Software Development for that matter, somebody surely makes use of buzzwords like OOPs, Moularity, Reusability,Abstraction, Inheritance, Polymorphism & what not. Use of a buzzword is not a big deal however, Knowing the meaning of these Buzzwords is really going to make a difference. This is not only true for discussions but for successful Software Design & Development.
Those who are intrested in making career in IT Industry should concentrate more on these concepts rather absorb these concepts. Thses concepts could be used for cracking Technical Interviews with any company in this world as well as they make sense when we are deeply involved in Software Development(initially) & Software Design (later on as a Software Architect/ Product Architect). Those who are alredy aware of these concepts could read this post as a refreshment.
Let's Start our bussiness without wasting much time. I hope you will enjoy this tour with me.
When we say "Object Oriented Programming", normally there is a question Why we need it?, What do you mean by Object? Is it very different from what we are doing (normally afrom "C" programmers). Let's tackle these questions one by one......................
Need for OOPs arises as , In real world each entity is an "Object" .What do i mean by this?. It's really simple, Look around yourself whatever you are looking at is an real world object. you find many such objects in everyday life, e.g. Car, Fan, Home, Any Vehicle, Bank acccount,Humans & On & On &On.... when we say software development we talk about software counterparts of such a objetcts. Software objects model real world objects. I know it's bit confusing....Let's make it very simple.......Any object(Real World/Software) has
a) State & b) Behavior
Car has a State e.g. Name of the car, Color, price, Fuel type,Speed etc. as well as car has a behavior e.g. Starting, Stopping (after applying breaks), Travelling with certail speed(with change in gear) etc. This could be applied to any object which comes to your mind & if you want you can chalk out those objetcs their state & behavior.
Now if you are thinking that you have received some valuable information from above paragraphs then whenever you think of any object ask two simple questions to yourself
1) What are the possible states of this object?
2) What possible behavior this object could perform?
As an assignment, Think of few objects & right down your observations on a piece of paper, I will take a break for 5-10 mins.
Done?
Hopefully "Yes"
Now see, If i am going to drive a car can i say in generic fashion that "A Person object is going to drive a Car Object"(I know its too boring, However if you replace "Person Object" with my name & "Car Object" with Car's name, sentence becomes specific), Coming back to our original discussion, this shows how two objects could interact. If i am driving a car if i press accelarator obviously its car behavior to speed up (intern changing its State: How? As speed is one of the parameter in a car's State, right?). if a t some point of time if i want to stop i will apply the breaks & again car will show its behavior of stopping/ Speed reuction (again state of the car is changed).
An Interesting thing to add is some parameters defined for car (in genral for any object rather) are static(they don't change frequently e.g. Color of the Car, Fuel type, Make etc.) & few are dynamic (Speed, Fuel level , Tyre Pressure etc.)
If you apply some thought on this you will find that entire world is full of objects exhibiting some state & showing some behavior. In software domain we should have exact replica of what we do normally in real world & Object Oriented Design does exactly the same.
In software development , Software objets are conceptually similar to real world objetcs. They also consisits of state & related behavior.
We will go into in depth discussion of "What are objetcs?" , "How they are represented?" & many more questions very shortly.
Friday, December 22, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment