System Design ( Day - 35 )

UML Diagrams ( Class Diagram, Sequence Diagram )
UML (Unified Modeling Language)
it is a standardised visual modeling language that is a versatile, flexible, and user-friendly method for visualising a system's design.
Types of UML
1. Class Diagram ( Structural UML ( Static ))
2. Sequence Diagram ( Behavioural UML ( Dynamic ))
Class Diagram
1. Class Structure
2. Association or Connection
Class Structure
Below Image will show how the class structure is designed, with the help of that image we can easily identify the Class Structure.
Example Structure
Below image will show how to design the class Structure, with the help of this we can easily design and display our classes.
Associations
1. Class Association → Inheritance
2. Object Association
Object Association
1. Simple Association
2. Aggregation
3. Composition
Inheritance ( is - a Relationship )
This can be represented like this ( ——» )
Object Association ( has - a Relationship )
Simple Association → There is a relationship between the classes which is simple which is represented as ( ——> ) For Example you are one class and your home is also one class then you live in your house the relationship between you and your house is simple you live in that house. that’s it.
Aggregation → This is represented by ( ———<> )
For Example A House is a class, and the Tv is a class, Chair is a class, table is a class here House is main thing, tv, chair and table are in the house. but they can exist individually right.
Composition
Let’s say Tv is a class, and Tv has its child classes like Screen, remote, speaker, motherBoard etc,
can these sub classes exist individually, No that is highly relatable because without TV class other classes can’t exist individually.
Sequence Diagram
in Simple words this is a behavioural diagram, in which this will tell you how the two objects or classes like A and B will interact with each other, when will it happen, how will it happen and all that will be defined here.
Terms that are present in Sequence Diagram.
1. Lifeline
2. Activation Bar
3. Messages → Asynchronous and Synchronous
4. Create Message, Destroy Message
5. Lost Message, Found Message
Lifeline: it will represent the Life of the class or the Object.
Activation Bar: after creating the object or class the activation bar will represent the active part of that object in the lifeline.
Message : in message we have to types
1. Synchronous : its like request and response.
2. Asynchronous : its like you don’t have to wait for the response, just you have to send.
Create Message: This will create an object or a class
Destroy Message: This will destroy some classes which has be created.
Lost Message: The message could not be received, before receiving the message the target class or object will be destroyed or gone inactive.
Found Message: Here we’ll get a message where we don’t know the source of the message.
Example for Sequence Diagram.
Atm
UseCase: A user will goes to atm with his Atm card and withdraws the money from his account, this is high level.
The user will ask money with his atm card, that atm machine will call and verify transactions like card Pin, amount, if everything is ok then it will call the cash dispenser to give the money to the customer.
Objects
1. Atm
2. User
3. Transaction
4. Account
5. Cash Dispenser
Above Image represents who the transaction happens from user end to cash dispenser.
That’s all for UML Diagram ( Class Diagram, Sequence Diagram )
Thank You.
Subscribe to my newsletter
Read articles from Manoj Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
