Encyclopedia  |   World Factbook  |   World Flags  |   Reference Tables  |   List of Lists     
   Academic Disciplines  |   Historical Timeline  |   Themed Timelines  |   Biographies  |   How-Tos     
Sponsor by The Tattoo Collection
Object (object-oriented programming)
Main Page | See live article | Alphabetical index

Object (object-oriented programming)

This article should be merged with  object (computer science)

In computer science, an object is something that has an identity, a state, and a behaviour. The state is encoded in instance variables (data members), the behaviour is encoded in methodss (member functions). Being composed of variables and methods that are very closely related, objects are often used to model real-world objects. Objects can be affected by eventss. Object-oriented programs typically contain a large number of objects.

Table of contents
1 Analogies
2 Overview of Identities, States, and, Behaviours
3 Object identity
4 Object state
5 Object behaviour
6 The Atomic Object and Encapsulation
7 Object-to-Object Communication


A class is to an object as a blueprint is to a house. An object belonging to a class is referred to as an instance of the class. If humanity were a class, then [you] would be an instance of the class [human].

Overview of Identities, States, and, Behaviours

The identity of an object from the class [dog] might be [Rex]. Its states may include being happy, black, and poodle. Rex can engage in behaviors such as sleeping, barking, and eating. An event affecting Rex might be that he is hit by a car. A program containing an object which represents a bicycle might report such states as velocity or temperature and such behavior as accelerating or the like.

Object identity

Object identity is a mechanism for distinguishing an object from any other object or entity. An object has identity that is separate from the value stored in the object. Object identity allows creation of references to the object.

Object identity is sometimes realized in programming languages by the location of the object in the computer's memory, and the operations with which references to this location are manipulated.

Object state

State of an object is the data stored in the object and modified by the methods that the object supports.

Object behaviour

Behaviour of an object is the set of methods that the object supports for changing its state, as well as invariants that those methods satisfy.

The Atomic Object and Encapsulation

In the atomic or cellular view of an object (or a class), the variables are considered to be within the nucleus and surrounded by methods. In other words, the variables and methods are encapsulated within the object. Each atom (or cell) is modular; modifications to the object do not require encapsulating code (that is, code which uses that object) to be rewritten, nor do the referenced objects need to be located within the same process or computer.

Object-to-Object Communication

Objects can interact and communicate with each other. If object A wants object B to perform one of B's methods, object A will send a message to object B. Consider a program which models driving a vehicle, Object A might be you and Object B might be a car. A message from A-B might involve identifying the object being called upon to perform some action [YourCar], the name of the method (or action) to perform [changeVelocity], and a parameter such as [muchFaster].

Read on: class, object (philosophy), object-oriented programming language, object-oriented programming, object-oriented technology, computing

See also: object creation