Thursday 5 December 2013

Object model components part 1

Object:
An object is a concept, abstraction, or thing with crisp boundaries and meaning for the
problem at hand. All objects have identity and are distinguishable
Objects are the physical and conceptual things we find in the universe around us. Hardware, software, documents, human beings, and even concepts are all examples of objects. For purposes of modeling his or her company, a chief executive officer could view employees, buildings, divisions, documents, and benefits packages as objects. An automotive engineer would see tires, doors, engines, top speed, and the current fuel level as objects. Atoms, molecules, volumes, and temperatures would all be objects a chemist might consider in creating an object-oriented simulation of a chemical reaction. Finally, a software engineer would consider stacks, queues, windows, and check boxes as objects.
Objects are thought of as having state. The state of an object is the condition of the object, or a set of circumstances describing the object. It is not uncommon to hear people talk about the "state information" associated with a particular object. For example, the state of a bank account object would include the current balance, the state of a clock object would be the current time, the state of an electric light bulb would be "on" or "off." For complex objects like a human being or an automobile, a complete description of the state might be very complex. Fortunately, when we use objects to model real world or imagined situations, we typically restrict the possible states of the objects to only those that are relevant to our models.
Objects are thought of as having state. The state of an object is the condition of the object, or a set of circumstances describing the object. It is not uncommon to hear people talk about the "state information" associated with a particular object. For example, the state of a bank account object would include the current balance, the state of a clock object would be the current time, the state of an electric light bulb would be "on" or "off." For complex objects like a human being or an automobile, a complete description of the state might be very complex. Fortunately, when we use objects to model real world or imagined situations, we typically restrict the possible states of the objects to only those that are relevant to our models.
We also think of the state of an object as something that is internal to an object. For example, if we place a message in a mailbox, the (internal) state of the mailbox object is changed, whereas the (internal) state of the message object remains unchanged.
An object
has the following four main characteristics:

• Unique identification
• Set of attributes
• Set of states
• Set of operations (behavior)
Unique identification, we mean every object has a unique name by which it is 
identified in the system. Set of attributes, we mean every object has a set of 
properties in which we are interested in. Set of states we mean values of 
attributes of an object constitute the state of the object. Every object will have 
a number of states but at a given time it can be in one of those states. Set of 
operations we mean externally visible actions an object can perform. When an 
operation is performed, the state of the object may change. 

The box may/may not be divided in
particular regions. Object instances can be used in instance diagrams, which
are useful for documenting test cases and discussing examples.

Class:
A class describes a group of objects with similar properties (attributes), common behavior
(operations), common relationships to other objects, and common semantics
A class describes a collection of similar objects. It is a template where certain
basic characteristics of a set of objects are defined. A class defines the basic
attributes and the operations of the objects of that type. Defining a class does
not define any object, but it only creates a template. For objects to be actually
created, instances of the class are to be created as per the requirement of the
case.
Classes are built on the basis of abstraction, where a set of similar objects is
observed and their common characteristics are listed. Of all these, the
characteristics of concern to the system under observation are taken and the
class definition is made. The attributes of no concern to the system are left
out. This is known as abstraction. So, the abstraction is the process of hiding
superfluous details and highlighting pertinent details in respect to the system
under development.
It should be noted that the abstraction of an object varies according to its 
application. For instance, while defining a pen class for a stationery shop, the 
attributes of concern might be the pen color, ink color, pen type etc., whereas 
a pen class for a manufacturing firm would be containing the other dimensions 
of the pen like its diameter, its shape and size etc. 
Each application-domain concept from the real world that is important to the 
application should be modeled as an object class. Classes are arranged into 
hierarchies sharing common structure and behavior and are associated with 
other classes. This gives rise to the concept of inheritance
Through inheritance, a new type of class can be defined using a similar 
existing class with a few new features. For instance, a class vehicle can be 
defined with the basic functionality of any vehicle and a new class called car 
can be derived out of it with a few modifications. This would save the 
developers time and effort as the classes already existing are reused without 
much change. 


No comments:

Post a Comment