How to Draw UML Diagrams - Class Diagram, Sequence Diagram, Use Case Diagram
How to Draw Class Diagram ?
Class diagrams are one of the most useful types of diagrams in UML as they clearly map out the structure of a particular system by modeling its classes, attributes, operations, and relationships between objects.
The class shape itself consists of a rectangle with three rows. The top row contains the name of the class, the middle row contains the attributes of the class, and the bottom section expresses the methods or operations that the class may use. Classes and subclasses are grouped together to show the static relationship between each object.
Basic components of a class diagram
- Upper section: Contains the name of the class. This section is always required, whether you are talking about the classifier or an object.
- Middle section: Contains the attributes of the class. Use this section to describe the qualities of the class. This is only required when describing a specific instance of a class.
- Bottom section: Includes class operations (methods). Displayed in list format, each operation takes up its own line. The operations describe how a class interacts with data.
Aggregation is a special type of association in which objects are assembled or configured together to create a more complex object. An aggregation describes a group of objects and how you interact with them.
Dependency relationship is a relationship in which one element, the client, uses or depends on another element, the supplier.
Composition represents whole-part relationships and is a form of aggregation.
Generalization is a relationship in which one model element (the child) is based on another model element (the parent).
Association is a relationship between two classifiers, such as classes or use cases, that describes the reasons for the relationship and the rules that govern the relationship.
Constraint is an extension mechanism that enables you to refine the semantics of a UML model element.
Note contains comments or textual information.
Example:
How to Draw a Sequence Diagram ?
Sequence diagrams are a type of Unified Modeling Language (UML) diagram that shows interactions over time. They’re also called event diagrams. A sequence diagram is a good way to visualize and validate various runtime scenarios.
Sequence Diagram Notations
Class Roles or Participants
Class roles describe the way an object will behave in context. Use the UML object symbol to illustrate class roles, but don’t list object attributes.
Activation or Execution Occurrence
Activation boxes represent the time an object needs to complete a task. When an object is busy executing a process or waiting for a reply message, use a thin gray rectangle placed vertically on its lifeline.
Messages
Messages are arrows that represent communication between objects. Use half-arrowed lines to represent asynchronous messages. Asynchronous messages are sent from an object that will not wait for a response from the receiver before continuing its tasks. For message types, see below.
Lifelines
Lifelines are vertical dashed lines that indicate the object’s presence over time.
Destroying Objects
Objects can be terminated early using an arrow labeled “<< destroy >>” that points to an X. This object is removed from memory. When that object’s lifeline ends, you can place an X at the end of its lifeline to denote a destruction occurrence.
Loops
A repetition or loop within a sequence diagram is depicted as a rectangle. Place the condition for exiting the loop at the bottom left corner in square brackets [ ].
Types of Messages in Sequence Diagrams
Synchronous Message
A synchronous message requires a response before the interaction can continue. It’s usually drawn using a line with a solid arrowhead pointing from one object to another.
Asynchronous Message
Asynchronous messages don’t need a reply for interaction to continue. Like synchronous messages, they are drawn with an arrow connecting two lifelines; however, the arrowhead is usually open and there’s no return message depicted.
Reply or Return Message
A reply message is drawn with a dotted line and an open arrowhead pointing back to the original lifeline.
Self Message
A message an object sends to itself, usually shown as a U shaped arrow pointing back to itself.
Create Message
This is a message that creates a new object. Similar to a return message, it’s depicted with a dashed line and an open arrowhead that points to the rectangle representing the object created.
Delete Message
This is a message that destroys an object. It can be shown by an arrow with an x at the end.
Found Message
A message sent from an unknown recipient, shown by an arrow from an endpoint to a lifeline.
Lost Message
A message sent to an unknown recipient. It’s shown by an arrow going from a lifeline to an endpoint, a filled circle or an x.
How To draw Use case Diagram ?
UML is a general-purpose modeling language that provides a standard way to visualize the design of a system.
Use case Diagram:
Use case diagram can summarize the details of your system’s users (also known as actors) and their interactions with the system. To build one, you’ll use a set of specialized symbols and connectors.
UML is the modeling toolkit that you can use to build your diagrams. Use cases are represented with a labeled oval shape. Stick figures represent actors in the process, and the actor’s participation in the system is modeled with a line between the actor and use case.
Use case diagram components
- Actors: The users that interact with a system. An actor can be a person, an organization, or an outside system that interacts with your application or system. They must be external objects that produce or consume data.
- System: A specific sequence of actions and interactions between actors and the system. A system may also be referred to as a scenario.
- Goals: The end result of most use cases. A successful diagram should describe the activities and variants used to reach the goal.
Use case diagram symbols and notation
The notation for a use case diagram doesn’t involve as many types of symbols as other UML diagrams.
- Use cases: Horizontally shaped ovals that represent the different uses that a user might have.
- Actors: Stick figures that represent the people actually employing the use cases.
- Associations: A line between actors and use cases. In complex diagrams, it is important to know I associate which actors with which use cases.
- System boundary boxes: A Box that sets a system scope to use cases. All use cases outside the box would be considered outside the scope of that system.
- Packages: A UML shape that allows you to put different elements into groups. Just as with component diagrams, these groupings are represented as file folders.
Note : Our project contains UML diagrams | Class Diagram | Sequence Diagram | Use Case Diagram for your final year projects : https://www.buyprojectcode.in/product-category/pg-projects/
For Engineering : https://www.buyprojectcode.in/product-category/engineering-projects/
Follow us on : https://www.facebook.com/buyprojectcode.in