Object (computer science)

This is an old revision of this page, as edited by Vera Cruz (talk | contribs) at 14:08, 16 January 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 behavior is encoded in methods (member functions). Objects are bundles of related variables and methods and are often used to model real-world objects. Objects can be affected by events. Object-oriented programs typically contain a large number of objects.

Overview of Identities, States, and, Behaviours

The identity of a dog might be "Rex". It's 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.

The Atomic Object and Encapsulation

In the atomic view of an object, 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.

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 aa vehicle, Object A might be you and Object B might be a car.

A message from you to Object B might involve the object your are addressing(YourCar), the name of the method (or action) to perform (changeVelocity), and a parameter such as (muchFaster).

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