Santosh,
This is not a simple question, but here's a simple answer:
Objects are data and the operations on that data combined
into one package.
But, as I said, it's not a simple question. So here's a longer answer.
Paraphrasing the term's inventor, Alan Kay. (Note: It is somewhat debatable
whether he coined the term "object" for this, but he was AFAIK the first to
say "object-oriented".)
Objects are self-contained units of information that allow you to send
messages to them that can:
- cause a change in the object's data (state)
- cause it to give you a response.
Those two options are not mutually exclusive. As Kay says, "The big idea is
'messaging'," but OO also requires minimally (this is also up for argument
in some camps) the following:
- inheritance: the ability to define an object that builds upon the
definition of another object. (Ex. I create a Toy object and then
build a Ball object using much of the definition of Toy.)
- polymorphism: the ability for many objects to understand the same
messages, but react/respond react/respond to them in different
ways. (Ex. A Ball responds differently to the message "freefall" than
a HeliumBalloon does. Hint: They go in different directions. ;-) )
- encapsulation: an object's implementation of a particular message
is not known nor needed by any objects that send that message.
(Ex. When I send the "freefall" message to Ball, I don't know whether
it's using a Newtonian algorithm contained within the Ball object or
it's actually delegating to a series of other physics-knowledgeable
objects. I just expect the Ball to drop and probably bounce in a way
that follows Newtonian physics.)
There are other features that are commonly found in OO languages. Classes
are the big one. A class is an object definition that can be used to create
multiple objects that have the same structure and that respond to the same
messages. For more info, see
http://c2.com/cgi/wiki?ObjectOrientedProgramming.
Also, there are several books available that cover OOP pretty well. One of
the first (and best, although I admit that I know one of the authors) is
Object-Oriented Programming by Peter Coad, Jill Nicola (ISBN# 013032616X).
The only problem you may have is that its examples are written in Smalltalk.
If you want to tackle it and do the examples yourself, I suggest going to
www.squeak.org for a Smalltalk environment.
~Mike
----- Original Message -----
From: "Santosh Varma" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 3:48 AM
Subject: Object Oriented ??
> can any one tell me what is meant by object oriented programming by a
simple
> and plain example ??
>
> regards,
>
> Santosh Varma
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html