Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

11135938

Class Diagram

A class diagram is a type of UML diagram that is used to


represent the structure and relationships of a system’s
classes. Classes are represented as boxes with three
sections: the name of the class, the attributes of the
class, and the operations of the class.

Here are the symbols used in a class diagram:

 Classes: represented by boxes with a name and


attributes and operations
 Attributes: represented by rectangles with a name and a
type
 Operations: represented by rectangles with a name and
a return type
 Inheritance: represented by a line connecting a child
class to a parent class
 Association: represented by a line connecting two
classes
 Multiplicity: represented by a number on the association
line indicating the number of instances of one class that
can be associated with another class

Here’s an example of a class diagram for a simple library


system:

+----------------+
11135938

| Library |

+----------------+

+----------------+

| Book |

+----------------+

+----------------+

| Author |

+----------------+

|
11135938

+----------------+

| Loan |

+----------------+

+----------------+

| User |

+----------------+

In this example, the Library class has three associations


with other classes: Book, Author, and Loan.
The Book class has a multiplicity of 1 or more
associations with the Loan class, indicating that one
book can be borrowed multiple times. The Author class
has a multiplicity of 1 or more associations with
the Book class, indicating that one author can write
multiple books.

Sequence Diagram
11135938

A sequence diagram is a type of UML diagram that is


used to represent the dynamic behavior of a system’s
classes. It shows how objects interact with each other
over time.

Here are the symbols used in a sequence diagram:

 Objects: represented by boxes with a name and a lifeline


 Interactions: represented by arrows between objects
 Messages: represented by arrows with a name and a
return value
 Time: represented by a horizontal axis with a series of
points representing the time at which events occur

Here’s an example of a sequence diagram for a simple


banking system:

+----------------+

| User |

+----------------+

+----------------+
11135938

| Log In |

+----------------+

+----------------+

| Check Balance|

+----------------+

+----------------+

| Withdraw |

+----------------+

|
11135938

+----------------+

| Deposit |

+----------------+

In this example, the user interacts with the system by


logging in, checking their balance, withdrawing money,
and depositing money. Each interaction is represented
by an arrow between the objects, and the messages
exchanged between objects are represented by arrows
with a name and a return value.

Use Case Diagram


A use case diagram is a type of UML diagram that is
used to represent the functional requirements of a
system. It shows the relationships between actors and
use cases.

Here are the symbols used in a use case diagram:

 Actors: represented by stick figures with a name


 Use cases: represented by ellipses with a name
 Extensions: represented by lines extending from the use
case to the actor
 Includes: represented by lines connecting the use case
to other use cases
11135938

Here’s an example of a use case diagram for a simple


online shopping system:

+----------------+

| User |

+----------------+

+----------------+

| Browse Products|

+----------------+

+----------------+

| Add to Cart |

+----------------+
11135938

+----------------+

| Checkout |

+----------------+

In this example, the user interacts with the system by


browsing products, adding them to their cart, and
checking out. Each use case is represented by an ellipse
with a name, and the relationships between the use
cases and the actors are represented by lines.

You might also like