Class Diagram - Step by Step Guide with Example

preview_player
Показать описание
In this video, you’re going to learn
1. What is the Class Diagram? 
2. How to find the required classes for the class diagram?
3. Association and type of association.
4. Aggregation and composition, Inheritance in the class diagram
5. Examples

Class Diagram is one of the important UML diagrams for software development which shows the object classes in the system and the associations between these classes. Simply, Class Diagrams visualize the object-oriented systems. 
The class diagram is a static type structure diagram that describes the structure of a system by showing the system’s classes, each class's attributes and operations, and also the relationship among the objects.
How to represent the classes in the class diagram?
The class diagram is represented by a rectangle box that contains three compartments. In the top compartment, we specify the class name, in the second or middle one, we specify the attributes whereas the third or last once is for the showing the methods or operations.
How do you find the required classes in the system?
Ya it’s true, all the domain classes that we separated while drawing the communication diagrams are the all classes which need to draw in the class diagram. For the moment we will concentrate on Domain Classes – so go through all the Collaboration Diagrams for the system and list the Domain Classes.
Association
If two classes exchange information in between or need to communicate with each other, then there must be a link in between them which is modeled by association relationship.
After the association relationship detection, we need to label the association relationship coz it’s not clear from the diagram what exactly associated between the classes. So that label the association relationship just above the line like Student chooses courses.
Even after the label on the association relationship, it’s still confusing to understand the diagram like Course choose the student or student choose the courses. The staff has a manager or manager has staff.

So that we place the small solid line with an arrowhead to guide the diagram like this. That is, Read the diagram from this direction. Like students choose the course.
Another important part of the class diagram is Multiplicity which is also known as cardinality.
Where ever the association relationship, there must be the multiplicity.
Aggregation is a special type of weaker Whole - Part association relationship between two classes where the part can exist separately from the whole.
Composition is also a special type of Whole – Part relationship between two classes where the part cannot exist separately from the whole. Here the relationship between whole and part is tighter.
The composition is represented by using a Filled diamond symbol pointed to the whole class.
One of the most important representations in the class diagram is Inheritance.
If two classes have a parent-child relationship, then they have an inheritance relationship.
Inheritance relationships between two classes represent similar to the Use Case generalization. Where we draw the solid line with arrowhead pointed to the parent or superclass.
Most of the cases, Parent or superclass is defined as an Abstract class whose object does not exist and its attributes and operations can only be used by its child classes. In this case, for the abstract class in the class diagram, the class name is written in Italic font or place in between double greater and less than sign as shown in the figure.
Association Class
If there need to provide additional information about the relationship between two classes, the association class is used. An association class is a class that is part of an association relationship between two other classes. An association class is particularly useful where there is a many to many relationships between the two classes.
Dependency Relationships do not have names but it is the weakest relationship that exists between two classes if the changes to the definition of one may cause a change into the other but not the vice versa.
In programming, passing objects as an argument represents the dependency relationship which means a class using another inside a method.

All these additional relationships between classes may allow a more detailed model of the problem Domain to be produced.

However, it is usually best to keep the diagram as simple as possible.
How to draw Use Case Diagram
How to verify Use Case Diagram
How to draw Communication or Collaboration Diagram
How to draw Sequence Diagram

SUBSCRIBE to our YouTube channel for more videos:

Рекомендации по теме
Комментарии
Автор

I'm sure you get this a lot but sir, you explained my 2 hour lecture in 20 minutes so much better than my professor, thank you!

samanosvasilias
Автор

Like how humble he is when he said: " I will try my best to explain". Excellent video BTW.

BIGMIND
Автор

This is a very clear explanation. I've gone through many, many articles and videos and this one is great.

PhrygianPhrog
Автор

Wow, this is the best explanation of Class Diagrams. Thank you

jenniferbabatunde
Автор

I read the comments first and subscribed immediately. currently watching and it's indeed helpful

funmilayobisola
Автор

You're a great teacher, this video has helped me to tackle my assignment..Thanks man..

mthokozisikhumalo
Автор

thank you for this video, I have learned more about class diagrams from this video than I learned from my lecturer

bennmorgan
Автор

Thank you sir! you are a great teacher! a blessing!

janphillipjuntado
Автор

A very useful lesson. Thank you so much!

minhduca
Автор

Wow i like the explanation...thank you sir

patrickdaka
Автор

Thank you so much, what an excellent explanation.

usamaabdulkhaliq
Автор

excellent presention, clear and to the point.

feelyd
Автор

Excellent man, thank you very much. So easy to follow and digest!

yosef
Автор

Thank you very much ! you explain it clearer more than other video '😄👍👍

blackonlearn
Автор

Thank you! This has been very useful and concise.

gthuang
Автор

I really liked your this way teaching, things were very clear to understand. But sir, I expected I will get a full class diagram example at the end ... But your this animated way is superb. Sir please make a Short video on a simple class diagram example too. 😊

geetachaudhary
Автор

Thank you so much May God Bless Your Soul ..

hamshihamsu
Автор

Thank you so much dear. God bless you!!!!

starvibes
Автор

What the difference between data model for database and the class diagram? When watching this video I found some similarity between those two diagram like association class in class diagram and composite entity in data model

jengfoongyang
Автор

Thank you so much... U done it very well .. it most useful for me...

dvyalogu