Understanding UML Diagrams: A Beginner's Guide

AbhiAbhi
4 min read

Hi everyone, today I will share my learning on UML Diagram. Before telling you about the UML Diagram

Let me give you an example: You and your friend are working on a project, and you have decided that the app workflow will be like this. Now, you have to explain it to your friend. You can write long paragraphs describing the approach, which will at times be monotone, or the approach is to make a diagram, which will help your friend understand properly. This diagrammatic flow is called UML, which stands for Unified Modeling Language.

Types Of UML Diagrams

The UML Diagrams are of two types:

1) Structural Diagram

2) Behavioural Diagram

We have in total 14 UML Diagrams, 7 Structural and 7 Behavioural, but out of 14, we only required 2, that is the Class Diagram from Structural and the Sequence Diagram from Behavioural. You will be thinking, what is the use of the remaining ones that have some uses, but when it comes to the interviews for the LLD System Design, the above two are enough

Class Diagram

Class diagram, the name depicts in this diagram we have to make classes that are involved in our project and along with the connection between these classes.

Above is the representation of the class where there is a class name, some variables or characters, along with some methods

Also, to use access modifiers we use + for public, - for private, # from protected

In order to represent abstract class just mention «abstract» on above of class block.

Now about association, there are two types of association:

1) Class Association - Inheritance

2) Object Association - Simple Association, Aggregation, Composition

Class Association (is-a relationship)

Class association is inheritance, it depicts is-a relationship like Manual Car is a Car, Electric Car is a Car

to show this relationship in the class diagram we use close arrow

Object Association (Composition)

It depicts has-a relationship. It includes three types of composition

1) Simple Association:

It is a weakest form of association like there is a human object arjun and house object there are related arjun has a house. It is depicted by open arrow.

Arjun→house

2) Aggregation:

In this type of composition when object comprises other multiple objects like Room includes sofa, curtains, table, Bed, Chair etc.. The connection is shown with the help of diamond and line (as shown in the below img). The bed, sofa, chair are the part of room but they can exist individually.

3) Composition:

In this association the chair object is made up of arms, wheels, seat then you will be thinking that it is same as aggregation but what makes it difference from aggregation is that the objects that are in room can exist indiviually but in this case they cannot exist.

This is a some representation of class diagram it is not that much detailed but you can get the idea

Sequence Diagram

It is a behavioural diagram in which we represent object as boxes and their interaction with arrows like send message as simple arrow and response as dotted arrow.

1) Object as Box

2) Lifeline

It depicts the time when object exists in the application

3) Activation Bar:

It depicts the time when object is active in the application

4) Messages:

There are two types of messages synchronous, asynchronous. In Synchronous if waits for response and only after getting the response it sends another message. But in Asynchronous it sends message one after another.

Create Message and Destroy Message

Lost and Found Messages

This below is an example of atm withdrawal (Sequence Diagram)

Conclusion

In summary, UML diagrams are essential tools for visualizing and communicating the structure and behavior of a system—especially in interviews or collaborative development. Whether you're designing a full-fledged application or just explaining your thought process, diagrams like Class and Sequence diagrams can make your ideas much clearer.

If you have any questions or noticed something I missed, feel free to share in the comments—I'm always open to feedback and learning together.

Thanks for reading, and see you in the next blog!

Peace ✌️ and Happy Learning!

0
Subscribe to my newsletter

Read articles from Abhi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhi
Abhi