#Chapter 2-1
#Chapter 2-1
Mattu University
Engineering and Technology College
Department of Computer Science
Software Engineering
UML is generally used to model software systems but it is not limited within
this boundary. It is also used to model non software systems as well like
process flow in a manufacturing unit etc.
Basics of UML
During the early 1990s, there were around 50 O-O methodologies
among them:
Rumbaugh’s Object Modelling Technique (OMT): Class and Associations
Wirfs-Brock(Class/Responsibility/Collaboration)CRC,
There are many methods and notations competing with each other that users are
distracted by the decisions they need to make.
Cont’d…
A single, common language is desirable because it can be used for all
development methods, used throughout the project lifecycle, and used for
different application technologies.
The Unification
Based on the fact that differences between the various methods were
becoming smaller.
Jim Rumbaugh and Grady Booch decided at the end of 1994 to unify
their work within a single method: the Unified Method.
A year later they were joined by Ivar Jacobson and the Unified Method
was transformed into UML- the Unified Modelling Language.
Goal of UML
A picture is worth a thousand words, this absolutely fits while discussing about
UML.
A conceptual model can be defined as a model which is made of concepts and their
relationships.
It helps to understand the entities in the real world and how they interact with
each other.
A. Structural
B. Behavioural
C. Grouping
Class:
Interface:
Collaboration:
Component:
Node:
Interaction:
Interaction is defined as a behavior that consists of a group of
messages exchanged among elements to accomplish a specific task.
State machine is useful when the state of an object in its life cycle is
important. It defines the sequence of states an object goes through
in response to events. Events are external factors responsible for
state change.
Cont’d…
C. Grouping things:
A grouping thing can be defined as a mechanism to group elements of a UML
model together.
There is only one grouping thing available:
Packages:
Package is the only one grouping thing available for gathering structural and
behavioural things.
D. Annotation things:
Annotation things can be defined as a mechanism to capture remarks,
descriptions, and comments of UML model elements. Note is the only one an
notational thing available.
Note: is used to render comments, constraints etc. of an UML element.
Cont’d…
2. Relationships – tie things together
Relationship is another most important building block of UML.
It shows how elements are associated with each other and this
association describes the functionality of an application.
There are four kinds of relationships available.
1. Dependency:
2. Association
3. Generalization
4. Realization
Cont’d…
Dependency (uses):
Dependency is a relationship between two things in which change
in one element also affects the other one.
Association
Association is basically a set of links that connects elements of an
UML model. It also describes how many objects are taking part in
that relationship.
Cont’d…
Generalization (is-a):
Generalization can be defined as a relationship which connects a
specialized element with a generalized element.
It basically describes inheritance relationship in the world of
objects.
Realization:
Realization can be defined as a relationship in which two elements
are connected. One element describes some responsibility which is
not implemented and the other one implements them. This
relationship exists in case of interfaces.
Cont’d…
A sematic relationship between classifier where in one classifier specify the
contract that another classifier is guaranteed to carry out.
Valida Validate
tion users
Can all features be performed by the use cases you have identified?
Sell Item
Reorder
<<Includes>>
Sales Clerk
Login
Add to Stock
<<Includes>>
<<Includes>>
Generate
Report
Manager
Cont’d…
Example2:Use case diagram representing the order management
system.
So if we look into the diagram then we will find three use cases (Order, Special-order
and Normal Order) and one actor which is customer.
The Special-order and Normal Order use cases are extended from Order use case. So
they have extends relationship.
Another important point is to identify the system boundary which is shown in the
picture.
Cont’d…
Uses Cases can be related
Extends Relationship
To represent seldom invoked use cases or exceptional
functionality
Denoted as dashed lines or paths with an open arrow-head
pointing an extension use case
Includes Relationship
<<extends>>
<<extends>>
<<extends>>
OutOfOrder <<extends>> TimeOut
Cancel NoChange
Cont’d…
<<includes>> relationship represents
common functionality needed in more
than one use case
Passenger <<includes>> behavior is factored out
for reuse, not because it is an exception
The direction of a <<includes>>
relationship is to the using use case
PurchaseMultiCard (unlike the direction of the
PurchaseSingleTicket <<extends>> relationship).
<<includes>>
CollectMoney
<<extends>> <<extends>>
<<extends>>
Pay Bill is a parent use case and Bill Insurance is the child use case.
(generalization)
Pay bill; the extending class Defer payment adds the behaviour of
List of Actors
A sequence diagram is an interaction diagram. From the name it is clear that the
diagram deals with some sequences, which are the sequence of messages flowing
from one object to another.
The sequence diagrams includes:-
The actor who initiate the use case.
The arrow in which the starting and ending point of action is identified.
The iteration loop in which process repeatedly checked until the required data is
matched.
Cont’d…
Return action
A return action is the return of a value to the caller, in response to a call
action
Cont’d…
Common Message Symbols…
Cont’d…
Common Message Symbols…
Cont’d…
Create action
A create action creates an object
It tells a class to create an instance of itself
Destroy action
A destroy action destroys an object
It tells an object to destroy itself
An object can perform a destroy action on another object, or on itself
Cont’d…
Send action
A send action sends a signal to an object
A signal is an asynchronous communication between objects
One object “throws” a signal to another object that “catches” the signal
The sender of the signal does not expect a response from the receiver (unlike
the sender of a call action)
Exceptions are the most common type of signals
action name
Cont’d…
Example 1: - Modelling a sequence diagram for the log-in use case
from the on-line Bookstore Case Study.
The main-flow of events that are involved is: -
1. The CUSTOMER clicks the Log-in button on the Home Page.
2. The system displays the Log-in Page.
3. The CUSTOMER enters his/her user ID and password. The
CUSTOMER clicks the OK button.
4. The system validates the log-in information against the ACCOUNT
table in the database.
5. CUSTOMER is an authorised user; the system displays the Personal
Home Page to the CUSTOMER
Cont’d…
Cont’d…
There are 3 types of analysis classes:
• boundary classes
• entity classes
• control classes
Instances of each of these analysis classes are called objects.
1. Boundary objects
• is an object with which an actor associated with a use case
interacts.
• if the actor is human, the boundary object may be a window,
screen, dialog box, or menu
• if the actor is non-human, the boundary object may be
application program interfaces (APIs)
boundary object
Cont’d…
2. Entity objects
• is an object that contains long-lived information, such as that
associated with databases.
• will be mapped to a table (part of the database) in the design phase
entity object
3. Control objects
• is an object that embodies application logic
• correspond with system actions (not actions taken by actors)
• are often used to handle things such as coordination and sequencing
• are also useful for calculations involving multiple entity objects
control object
Cont’d…
Using the previous example (the log-in use case of the Online
Bookstore), we can identify that
the HomePage and Log-in Page objects are boundary objects,
whereas the Account object is an entity object.
Therefore, taking this into account, we can draw a new interaction
diagram.
Cont’d…
Cont’d…
Use Case: Register
Main flow of events:
1. The CUSTOMER clicks the REGISTER button on the Home Page.
2. The system displays the Register Page.
3. The CUSTOMER enters all of the required information.
4. The CUSTOMER clicks the SEND button.
5. The system checks that all of the required information were entered.
If
yes, the system update the CUSTOMER’s record in the CUSTOMER
and ACCOUNT tables in the database. System displays OK message.
Objects:-
CUSTOMER: actor
CUSTOMER and ACCOUNT: entity objects
Home Page and Register Page: boundary objects
Cont’d…
Cont’d…
Case Study: Order Books
Main Flow of events: -
1. The CUSTOMER enters the keyword for a book and clicks
the
SEARCH button on the personal Home Page.
2. The system displays the matching books on the web Page.
3. The CUSTOMER chooses the desired book and clicks the
ADD TO
SHOPPING CART button on the web page.
4. The system adds the book into the CUSTOMER’s Order
table in the
database.
Objects:
Customer: actor
Home Page: boundary object
Book and Order: entity object
3. Class Diagram
We use the class diagram to model the static structure of a system,
thus Class diagram describing the elements of the system and the
over time.
For example, students have a name and ID number and attend various courses.
The class diagram is without doubt the most widely used UML diagram.
Cont’d…
Objects
A system contains numerous different individuals.
Classes
A class is the construction plan for a set of similar objects that appear
Classes…
The type of the attribute may be specified after the name using : Type.
Possible attribute types include primitive data types, such as integer and string,
composite data types, for example a date, an enumeration.
Operation…
Operations are characterized by their name, their parameters, and the type of their
return value.
When an operation is called in a program, the behaviour assigned to this operation
is executed.
In a class diagram, the operation name is followed by a list of parameters in
parentheses.
Cont’d…
Visibilities of attribute and operation can be explained in below table
Cont’d…
Example 1(see the #Sign in front of attribute and operation)
Cont’d…
Class relationships
Cont’d…
Class relationships…
Association: Associations are similar to classes, in that
they can have attributes and operations attached to them.
Relationship between two or more to involve connection.
Cont’d…
Class relationships…
Aggregation: Relationships between the whole and components
(specific).
Cont’d…
Class relationships…
Composition: The composition relationship is represented by a straight line with a
black diamond at one end. In UML, it can exist between two or more classes. It is a part
of the association relationship.
Cont’d…
Generalization (inheritance): The relationship between
superclass and subclass.
Identify the possible states in which the object can exist (boundary
Component
interface
Cont’d…
Component Diagram shapes and symbols
Cont’d…
Component Diagram shapes and symbols…
Cont’d…
Component Diagram shapes and symbols…
Cont’d…
Components can represent:
Files (source code) or Help file
Tables (data base)
Applications
Server
Clients
Cont’d…
Example: online student registration system
data access
Admission officer
admission officer
<<infrastructure>>
access option security
data access
Registration
Registration
data access
Grade Submission/Report <<infrastructure>>
Grade submition/report persistence persistence
data access
Transfer case
Transfer case
data access
Add and Drop case DB
Add and Drop
MEU Registrar
DB server Appn.java
Database
Cont’d…
Once the installation and the registration are done, iTunes application
can easily interconnect with the Apple iTunes store.
Users can purchase and download music, video, TV serials, etc. and
cache it in the media library.
Devices like Apple iPod Touch and Apple iPhone can update its own
media library from the computer with iTunes with the help of USB
or simply by downloading media directly from the Apple iTunes store
using wireless protocols, for example; Wi-Fi, 3G, or EDGE.
Diagram Extension