In this post we are going to learn about UML Class Diagrams. Before learning about the class diagrams. First, understand- What is UML and its diagram types?
We know that in case of UML we’re having multiple different diagrams. So, like other diagrams also class diagram is having its special dedicated purposes in the software application development.
- A class diagram is a static diagram. It represents the static view of an application.
- Class diagram is not only used for visualizing, describing and documenting the application but also it is used for the constructing executable codes of the software application.
So that’s why this class diagram is having a special purpose. A class diagram is nothing but consisting of multiple classes.
So, the rectangular box(see in figure) is denoting one class and the box is having three sections.
- The first section is depicting the class name.
- Next section, it will be consisting of multiple different attributes or we can also call it as messages or member variables.
- And the third section will be containing the methods or the member functions of those classes.
So, this class diagram is consisting of multiple different classes where each and every class will be expressed in the form of an rectangle with three sections. The first section will be holding the class name. The name should be very much purposeful. We can’t go for any abstract name. Then, the second section will be containing the member variables that means the attributes and the third section will be containing the member functions or the methods.
So, you have seen the class diagram. In the diagram, there is a symbol(pointed arrow symbol). This symbol is actually denoting the aggregation.
So, now this is a enumeration(in separate box). The name of this enumeration is “book category” and it can have three different values that is a there is a mystery then science fiction and then biography. So, these are the three different book categories that possible.
So, this class diagram will help the coder to write the code and for the software development.
- Class diagram describes the attributes and operations of a class and also constraints imposed on the system.
That means what are the attributes? They’re the member variables as discussed above. And what are the parametric operations? That will be described in the form of the methods which will be included in the class.
- The class diagram are widely used in the modeling of object-oriented systems because they are the only UML diagrams, which can be mapped directly with the object-oriented language.
So, that is the special purpose of the class diagram. There is no other diagram, which will map this particular directly to the object-oriented programming languages.
So here, we are having the some more detailing about class diagram.
Class diagram shows the collection of classes, interfaces, associations, collaborations and constraints. It is also known as the structural diagram.
So, this is a static structural diagram. You can see(below diagram) that we have given one example of a class diagram in which all the required attributes are mentioned.
The minus(-) signs are indicating that they are under the private scope. Whenever, we are mentioning the methods or the respective member functions in the class which will describe what are the permitted operations we can carry out on those attributes. So, they have been denoted preceded by the plus(+) symbol to indicate that they are under the public section.
So, here we are having the another one there is a CUP. Here, we are having some members, the member variables or the attributes. So, under the private scope and this particular method overflow() is under the public section. So, we are having the output arguments and denoting that what is the type of that attribute.
-name : String -section : String -item : Cup = void -fatigue : boolean
As you can see the types of attributes: name would be of the type string, section will be of the type of string and item : cup is of the type of void. Also, you can see that cup has been inherited by the coffee cup and the plastic cup. So, that is the symbol which is denoting inheritance or generalization.
So, that’s all about the introduction of Class Diagrams. There are more things to learn in class diagram. Don’t forget to read from below links.
Wants to know the purpose of Class diagram and how to draw a class diagram? Read the next post to understands the concept in easy way:
For frontend projects, check and implements these beginner’s friendly projects :- TOP 7 PROJECTS FOR BEGINNERS TO PRACTICE HTML & CSS SKILLS
Want backlinks to your website? Follow this article and get to know in very easy way. How You Can Create High Quality Backlinks In 2021?
Learn about 404 ERROR page – EVERYTHING YOU NEED TO KNOW ABOUT 404 ERROR PAGE FOR SEO
For competitive and university level exams learning with MCQs visit the below links–
Do practice of HTML :- Multiple choice questions on HTML
Do practice of C++ programming :- Multiple choice questions on CPP programming
Do practice of C programming :- Multiple choice questions on C programming
Do practice of Software Engineering: Multiple choice questions on SE
In case, you find any typographical, grammatical or any other error in our site then kindly inform us. Don’t forget to provide the appropriate URL along with error description.
Thanks in advance.