December 21, 2024
Object Attributes
In our attempt to simulate some aspect of the world about us, we create objects. These objects are given attributes. Attributes, or properties, enable objects to model those aspects of the world that we, as designers and engineers, have selected as necessary for the successful construction of a software system. How we make those decisions will become clearer when you reach the Software Development section of this course.
Another way of talking about attributes is to say that an attribute is the information, or data, that an object needs in order to fulfil its required behaviour and, furthermore, the state of an object is the value of its attributes. Requirements and behaviour do not drop out of thin air. What is required behaviour and who deems it necessary?
A software developer may be asked to produce a system for a company. For the purposes of this discussion I won't get into any details about what the company wants. Suffice to say that after lengthy and costly meetings a document is drawn up that states quite categorically what this system is required to do. This document is called a Negotiated Statement of Requirements and you will meet examples of this later in the course.
Software development involves detailed analysis of the NSR. One of the first tasks in this process is to think about classes. Classes act as templates for the manufacture of the objects that will be used in the system. A system will be required to behave in a certain manner, as stipulated by the NSR, and objects will be used to make this happen.
In the development process, decisions are made that eventually result in the manufacture of objects. OOP employs the concept of responsibility-driven design. Objects are delegated responsibilities, such as maintaining references to data (in Smalltalk this will always be an object, other languages e.g. Java, will use scalars - numbers or strings etc.), or keeping track of other objects. These objects will fulfil their responsibilities by collaborating with other objects in a carefully planned process that involves messages being sent to each other. Sending a message to an object may cause that object to change its state, or a message from one object may simply request information about the state of another object. This process is all about getting objects to do something, to behave in some pre-determined fashion. For this to take place, objects must hold information; they must possess attributes, which enable them to behave in a manner that ensures the correct behaviour of the system.
Now that we have looked at attributes we can return to the templates, the classes, used for the manufacture of objects. Where do these templates come from and what are some of the decisions that inform their construction?
Next page » Class
Previous page « Reuse
Previous page « Abstraction
⇑ Up to top of page