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

ADVANCED PROGRAMMING WITH JAVA

AND UML
CSC 417

By
Dr. Salamudeen Alhassan

March 30, 2022


UML Diagrams

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 2 / 19
Class Diagram

It is a static diagram.
It represents the static view of an application.
It is used for visualizing, describing, and documenting different
aspects of a system as well as for constructing executable code
of the software application..
It describes the attributes and operations of a class and also the
constraints imposed on the system.
it is widely used in the modeling of object oriented systems.
It shows a collection of classes, interfaces, associations,
collaborations, and constraints.
It is also known as a structural diagram.

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 3 / 19
Class Diagram cont.

Purpose of Class Diagrams


Analysis and design of the static view of an application.
Describe responsibilities of a system.
Base for component and deployment diagrams.
Forward and reverse engineering

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 4 / 19
Class Diagram cont.
How to Draw a Class Diagram?
The name of the class diagram should be meaningful to describe
the aspect of the system.
Each element and their relationships should be identified in
advance.
Responsibility (attributes and methods) of each class should be
clearly identified
For each class, minimum number of properties should be
specified, as unnecessary properties will make the diagram
complicated.
Use notes whenever required to describe some aspect of the
diagram. At the end of the drawing it should be understandable
to the developer/coder.
ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 5 / 19
Class Diagram cont.
How to Draw a Class Diagram?
Class name
The name of the class appears in the first partition.
Class Attributes
Attributes are shown in the second partition.
The attribute type is shown after the colon.
Class Operations (Methods)
Operations are shown in the third partition.
The return type of a method is shown after the colon at the end
of the method signature.
The return type of method parameters are shown after the
colon following the parameter name.
Class Visibility
Visibility of attributes and operations are denoted by the +, -
and # symbols.
ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 6 / 19
Class Diagram cont.
How to Draw a Class Diagram?

Description Symbol

Class signature

Class Operations

Class Visibility

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 7 / 19
Class Diagram cont.

Class relationships

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 8 / 19
Class Diagram Cont.
Class Diagram Example: Order System

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 9 / 19
Class Diagram Cont.

Class Diagram Example with Notes

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 10 / 19
Class Diagram Cont.

Class Diagram Example: Order System

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 11 / 19
Use Case Diagram

It is a representation of a user’s interaction with the system that


shows the relationship between the user and the different use
cases in which the user is involved.
It is the primary form of system/software requirements for a new
software program underdeveloped.
Use cases specify the expected behavior (what), and not the
exact method of making it happen (how).
It helps us design a system from end user’s perspective.
Use case diagrams consists of actors, use cases and their
relationships.
Use case diagrams are drawn to capture the functional
requirements of a system.

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 12 / 19
Use Case Diagram cont.

Purpose of Use Case Diagrams


Any real-world system is used by different users.
Before designing a system, the architecture is made with
different perspectives in mind.
Use Case is primarily
Used to gather the requirements of a system.
Used to get an outside view of a system.
used to identify the external and internal factors influencing the
system.
Used to validate a systems architecture
Used to drive implementation and generate test cases

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 13 / 19
Use Case Diagram cont.
How to Draw a Use Case Diagram?
Identify the
Functionalities to be represented as use case.
Actors.
Relationships among the use cases and actors.
Give name to use cases that identify the functionalities they
performed.
Give a suitable name for actors.
Show relationships and dependencies clearly in the diagram.
Do not try to include all types of relationships, as the main
purpose of the diagram is to identify the requirements.
Use notes whenever required to clarify some important points.

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 14 / 19
Use Case Diagram - Notations

Use Case Diagram at a glance

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 15 / 19
Use Case Diagram - Notations

Notation

Notation Symbol

Actor

Use case
Communication

Boundary of Sys-
tem

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 16 / 19
Use Case Diagram - Relationship

Relationship

Relationship Symbol Example


Extends
Include

Generalization

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 17 / 19
Use Case Diagram - Example
Sample Use Case Diagram of an order management system

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 18 / 19
Example using ER Diagram

ER Diagram

ByDr. Salamudeen Alhassan ADVANCED PROGRAMMING WITH JAVA AND UML March 30, 2022 19 / 19

You might also like