Class model defines the structure of the entire system by identifying the static structure of objects in that system. A class model defines attributes and operations for the objects of each class and also the relationship between the objects in the systems.
A class model prepares the platform for the other two models i.e. the state model and interaction model. Class model is considered important as it represents the graphical representation of the entire system and helps in analysis while communicating with the customers.
The motive behind constructing the class model is to concentrate on those concepts of real world that are important from the application point of view. In this section, we will discuss the class model along with its elements like the objects, classes, links and association between the classes.
Content: Class Model
- Objects in Class Model
- Classes in Class Model
- Relationship Between Objects and Classes
- Key Takeaways
Objects in Class Model
An object is an abstracted thing that comprises data structure and behaviour. Each object can be identified distictly from the application perspective. The objects that share the same data structure and behaviour are classified to a single class.
We can classify the object into two types, concrete object and a conceptual object. A concrete object is the one which has existence in the real world, for example, Jhon, IBM company, a file in a file system etc. Conceptual object is one which has existence in the real world but can not be accessed or sensed for example an insurance policy, a formula to solve a quadratic equation, scheduling policy of an operating system etc.
The objects in the system are identified from the problem statement provided for developing the software. Generally, the objects in the system are proper noun and identified such that they are important from the applications view point.
Every object is distinctly identified in the system, even though they have the same attribute values and share the same functions. Consider two bikes that are of the same company, same model, same features and even have the same colour. Still, two bikes are two different instances of the same class and have an individual identity.
Classes in Class Model
We can define a class as a group of objects possessing the same attributes and the same operations. An object is said to be an instance or an occurrence of the class. To understand this in a better way consider a class Person. Look at the image below you can observe, two objects of the class person i.e. Joe and Smith. They share the same attributes such as name, city and same operation such as change-city, change-job.
Generally, a class is always a common noun or a noun phrase that is derived from the problem statement provided to develop the system. Objects in the class can be distinguished identically on the basis of their attribute values although two objects from the same class can have all attributes values same.
Whenever the class is derived from the problem statement, choice of its properties (attributes) and behaviour (operation) depends upon the purpose of the application while the rest properties and functions are ignored.
Let us suppose, a company has several people then they all will be classified to a class employee. Now consider a shopping centre here the people will be classified into two different classes employee and customer. So, the interpretation of the classes depends on the purpose of the application.
The class model is represented using the class diagram which is the graphical representation of the classes and their relationship with each other. It also describes the possible objects for each class.
Relationship Between Objects and Classes
To define the relationship between the objects and classes two terms are used, link and association. A link defines the connection between the objects. A link can relate two or more objects.
Association can be defined as the group of links and a link is said to be an instance of the association. Like a class describes all possible objects similarly association describe all possible links. In a problem statement, a link or association can be identified by the verbs present in the problem statement.
When some classes have some common features then those features are factored out in a superclass. The superclass has the general information which is shared by all its subclasses. This relation between a superclass and one or more of its subclasses is called Generalization.
Generalization is referred to as ‘is-a’ relationship. The concept of generalization organizes the classes in a hierarchy where the subclasses inherit the features of superclass.
- The class model is the graphical representation of the structure of the system and also the relation between the objects and classes in the system.
- Each object in the system has data structure and behaviour.
- Object sharing the same features are grouped to a class.
- Objects are the proper nouns and classes are common nouns identified in the problem statement provided for the development of the application.
- The relationship between the objects is the link and the group of links with the same structure is termed as an association.
- The class model focuses on the factors that are essential from the applications point of view.
So, this is all about the class model which is the graphical representation that incorporates objects, classes, the relation between objects and classes.