Looking at the meaning of the word ‘objects’
1 a material thing that can be seen and touched: he was dragging a large object | small objects such as shells.
• Philosophy a thing external to the thinking mind or subject.
2 a person or thing to which a specified action or feeling is directed: disease became the object of investigation | he hated being the object of public attention.
• a goal or purpose: the Institute was opened with the object of promoting scientific study.
3 Grammar a noun or noun phrase governed by an active transitive verb or by a preposition. in Gaelic the word order is verb, subject, object.
4 Computing a data construct that provides a description of anything known to a computer (such as a processor or a piece of code) and defines its method of operation. the interface treats most items, including cells, graphs, and buttons, as objects.
noun |(stress on the first syllable)|
1 wooden objects: thing, article, item, piece, device, gadget, entity, body; informal thingamajig, thingamabob, thingummy, whatsit, whatchamacallit, what-d’you-call-it, thingy; Brit. informal doodah, doobry, gubbins; N. Amer. informal doodad, doohickey, doojigger; N. Amer. & S. African informal dingus. ANTONYMS abstract idea, notion.
2 he became the object of fierce criticism: target, butt, focus, recipient, victim.
3 the Institute was opened with the object of promoting scientific study: purpose, objective, aim, goal, target, end, end in view, plan, object of the exercise; ambition, design, intent, intention, idea, point.
Correlation between Physical Object & Object in Computing
What Makes an Object?
It is easier to list things that are objects than to list things that are not objects. Just to talk about something seems to make it an object, somehow. René Descartes (the 17th century philosopher) observed that humans view the world in object-oriented terms. The human brain wants to think about objects, and our thoughts and memories are organized into objects and their relationships. Perhaps non-human brains work differently.
One of the ideas of object-oriented software is to organize software in a way that matches the thinking style of our object-oriented brains. Instead of machine instructions that change bit patterns in main storage, we want “things” that “do something.” Of course, at the machine level nothing has changed—bit patterns are being manipulated by machine instructions. But we don’t have to think that way.
- An object is made of tangible material (the pen is made of plastic, metal, ink).
- An object holds together as a single whole (the whole pen, not a fog).
- An object has properties (the color of the pen, where it is, how thick it writes…).
- An object can do things and can have things done to it.
Characteristics of Objects
The first item in this list is too restrictive. For example, you can think of your bank account as an object, but it is not made of material. (Although you and the bank may use paper and other material in keeping track of your account, your account exists independently of this material.) Although it is not material, your account has properties (a balance, an interest rate, an owner) and you can do things to it (deposit money, cancel it) and it can do things (charge for transactions, accumulate interest).
The last three items on the list seem clear enough. In fact, they have names:
- An object has identity (each object is a distinct individual).
- An object has state (it has various properties, which might change).
- An object has behavior (it can do things and can have things done to it).
This is a somewhat ordinary description of what an object is like. (This list comes from the book Object-oriented Analysis and Design, by Grady Booch, Addison-Wesley, 1994.) Do not be surprised if other notes and books have a different list. When you start writing object-oriented software you will find that this list will help you decide what your objects should be.
Many programs are written to do things that are concerned with the real world. It is convenient to have “software objects” that are similar to “real world objects”. This makes the program and what it does easier to think about. Software objects have identity, state, and behavior just as do real world objects. Of course, software objects exist entirely within a computer system and don’t directly interact with real world objects.
Software Objects as Memory
It is only a slight exaggeration to say that memory (both main memory and secondary memory) is what a computer is about. The rest of the electronics—the processor chip, the buses, the power supply, the keyboard, the video card and so on—exist only to work on memory and to show what it contains. So what else could a software object be but a chunk of memory?
(Actually, it is not quite correct to claim that a software object is a “chunk” of memory. A software object is somewhat like a bank account—its existence is spread out and does not correspond one-to-one with any particular piece of material. But for now it is convenient and reasonably accurate to think of a software object as a chunk of memory.)
Objects (real world and software) have identity, state, and behavior.
Software objects have identity. Each is a distinct chunk of memory. (Just like a yellow tennis ball, each software object is a distinct individual even though it may look nearly the same as other objects of the same type.)
Software objects have state. Some of the memory that makes up a software object is used for variables which contain values. These values are the state of the object.
Software objects have behavior. Some of the memory that makes up a software object contains programs (called methods) that enable the object to “do things”. The object does something when one of its method runs.
Picture of an Object
In terms of object-oriented programming, a von Neumann computer uses general purpose memory to store both the state and behavior of objects. It is interesting that an idea from the 1940’s is still important.
A software object consists of both variables (state information) and methods (recipes for behavior). In the picture, the yellow bricks represent bytes of memory out of which the object is built. This object has some variables, location, color, and size, and has some methods that control its behavior.
In object-oriented programming, the programmer uses a programming language (such as Java) to describe various objects. When the program is run (after being compiled) the objects are created (out of main storage) and they start “doing things” by running their methods.
The methods must execute in the correct order. For an application, the first method to run is the method named main(). There should be only one method named main() in an application. In a small application, main() might do by itself all the computation that needs to be done. In a larger application, main() will create objects and use their methods.