In: Computer Science
“A complete and consistent class diagram is all that is required to implement and to understand an application”. Discuss the correctness or otherwise of this statement. In your answer, among other things, consider how class diagrams evolve and who has a stake in the understanding and implementation of an application.
Yes, The given statement is also correct but it is in a simple way.
As per my knowledge
The class diagram is a static diagram. It represents the static view of an application. The class diagram is not only used for visualizing, describing, and documenting different aspects of a system but also for constructing executable code of the software application.
The class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class diagrams are widely used in the modeling of object-oriented systems because they are the only UML diagrams, which can be mapped directly with object-oriented languages.
The class diagram shows a collection of classes, interfaces, associations, collaborations, and constraints. It is also known as a structural diagram.
Purpose of Class Diagrams:
The purpose of the class diagram is to model the static view of an
application. Class diagrams are the only diagrams that can be
directly mapped with object-oriented languages and thus widely used
at the time of construction.
UML diagrams like activity diagram, sequence diagram can only give the sequence flow of the application, however, the class diagram is a bit different. It is the most popular UML diagram in the coder community.
The purpose of the class diagram can be summarized as −
Essential elements of A UML class diagram:
Class Name:
The name of the class is only needed in the graphical representation of the class. It appears in the topmost compartment. A class is the blueprint of an object which can share the same relationships, attributes, operations, & semantics. The class is rendered as a rectangle, including its name, attributes, and operations in sperate compartments.
Following rules must be taken care of while representing a class:
Attributes:
An attribute is named property of a class that describes the object
being modeled. In the class diagram, this component is placed just
below the name-compartment.
A derived attribute is computed from other attributes. For example, an age of the student can be easily computed from his/her birth date.
Attributes characteristics
Relationships
There are mainly three kinds of relationships in UML:
Dependency
A dependency means the relation between two or more classes in which a change in one may force changes in the other. However, it will always create a weaker relationship. Dependency indicates that one class depends on another.
In the following example, Student has a dependency on College
Generalization:
A generalization helps to connect a subclass to its superclass. A sub-class is inherited from its superclass. Generalization relationship can't be used to model interface implementation. Class diagram allows inheriting from multiple superclasses.
In this example, the class Student is generalized from Person Class.
Association:
This kind of relationship represents static relationships between classes A and B. For example; an employee works for an organization.
Here are some rules for Association:
Multiplicity:
A multiplicity is a factor associated with an attribute. It specifies how many instances of attributes are created when a class is initialized. If a multiplicity is not specified, by default one is considered as a default multiplicity.
Let's say that that there are 100 students in one college. The college can have multiple students.
Aggregation
Aggregation is a special type of association that models a whole- part relationship between aggregate and its parts.
Composition:
The composition is a special type of aggregation which denotes strong ownership between two classes when one class is a part of another class.
For example, if college is composed of classes student. The college could contain many students, while each student belongs to only one college. So, if college is not functioning all the students also removed.
The class diagram is evolved for gving overview of the system or project how going to develop it is.
The stakeholders in the understanding and implementation of an application is the developers because they have to implement the project or system using the class diagram they can easily understand everything about the project how to develop it.And also Admins they are the ones who are going to use the system so they have to have this understandnig for hosting the system and to understand how the functionalities are working in the system .