0% found this document useful (0 votes)
31 views59 pages

Unit 2 Uml

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views59 pages

Unit 2 Uml

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

Object Modeling Using UML

Object oriented analysis is the process of identifying and describing the


objects for given problem instance.
For example: For designing the banking systems
Object oriented design is the process of defining the objects and their
collaboration with the other objects in order to fulfill the requirements
Goals of UML:
• The primary goal of UML is to define some general-purpose simple
modeling language so that all modelers can use and understand.

• UML is not a development method rather it accompanies with


processes to make a successful system.
Three ways of using UML
• UML as sketch
• UML as blueprint
 In reverse engineering
In Forward Engineering
• UML as programming language
UML can be applied as three perspectives
• Conceptual perspective
• Specification perspective
• Implementation perspective

Meaning of class in different perspective :


• Conceptual Class
• Software class
• Implementation class
UML Diagrams
• Diagrams are the graphical representation of the set of the elements.
• Diagram can be drawn to represent the system from different
perspectives.
• Same elements may appear in different diagrams.
• The diagram contains the collection of elements and relationship
among these elements.
Types of UML Diagrams
1.Class Diagram
2.Object Diagram
3.Component Diagram
4.Use Case Diagram
5. Sequence Diagram
6. State Diagram
7. Activity Diagram
8. Deployment Diagram
9. Package Diagram
• Class Diagram :Class diagrams are one of the most widely used
diagrams. It is the backbone of all the object-oriented software
systems.
• Object Diagram : It describes the static structure of a system at a
particular point in time. It can be used to test the accuracy of class
diagrams.
• Component Diagram: It portrays the organization of the physical
components within the system. It is used for modeling execution
details.
• Use Case Diagram: It represents the functionality of a system by
utilizing actors and use cases. It encapsulates the functional
requirement of a system and its association with actors.
• Sequence Diagram: It shows the interactions between the objects in
terms of messages exchanged over time. It delineates in what order
and how the object functions are in a system.
• State Diagram: It represent the states, transitions ,activities and
events.
• Activity Diagram: It models the flow of control from one activity to
the other. With the help of an activity diagram, we can model
sequential and concurrent activities.
• Deployment Diagram: It presents the system's software and its
hardware by telling what the existing physical components are and
what software components are running on them
• Package Diagram: It is used to illustrate how the packages and their
elements are organized. It shows the dependencies between distinct
packages.
Use case Model
• During requirement gathering the primary requirements of the
system are understood .The basic requirements of the system are
called the functional requirements.
• The use cases are the textual representation of particular scenario,
whereas the use case model is the graphical representation of the
scenario.
Following table shows the template of the use case
Use case template

Use case Write the name of the scenario

Primary Actor Specify the role of the entity who interacts with the system

Goal in context Specify the purpose of this use case scenario

Preconditions The condition that is to be satisfied before the use case start

Scenario Sequence of steps that describe the main scenario

Triggers Extension points Event due to which the function starts, is described

Exception Describe the exceptional situations that may occur during the execution

priority Describe the necessity of the system to be implemented

Open issues Certain additional issues that are required for execution of the scenario.
Actors , Scenarios and Use cases

Actor Action
Fig: Actor and Action representation
Use case are the fundamental units of modelling language in which
functionalities are distinctly represented.
 The first step in writing use case is to identify the actors.
Actor is everything that communicates with the system or product
Ex: Customer, Inventory database, Accountant
• Scenario is a specific sequence of actions or interactions between
actor and the system . It is also called as use case instance. The
scenarios describe the text stories .
• Example : online purchase system.
• Main Scenario: User browser for the product online. Then user
selects the desired products and adds it in shopping basket.
• Alternate scenario: If the credit card information is incorrect , then
asks the customer to try again or asks for giving the cash incase.
Use case and use case model
• Use case modeling is done during the requirement analysis phase.

• Use cases are the text documents and the use case modeling is an act
of writing the text and not the diagrams.
Abstract and concrete use case
• Abstract use case is use case which does not have complete
declaration.
• The declaration in this use case is incomplete
Relationships in use cases
• Several use cases can be related with each other. Similarly the use
cases are also related to the actors who are intended to achieve the
goal of the system . The use cases are related to any other entity by
using include , extend and generalization relationship.
Include
• This is the most commonly used relationship which denotes that a
given use case my include another. It is denoted by
------------------>
<<Include>>
Use case for payment for the product
(Include –Relationship)
Extend

• The extend relationship is used when an extended use case is


connected to the base use case.
• The relationship is denoted by
--------------->
<< extend >>
Use case for browsing product
(Extend relationship)
Generalization
• In this type of relationship there are two types of use cases – the
parent use case and the child use cases.
• The test word used for generalization relationship is “kind of”. It is
denoted by

Generalization
Generalization Use case
When to use use cases ?
• Following are some reasons why use cases are important-
1.By modelling the behavior of elements
2.Using use cases, developers can identify and understand various
system elements.
3.Use cases serve as the basis for the test cases.
Use case for admission to the hospital
Class diagram
• A class represents a collection of objects having the same
characteristics properties that exhibit common behaviour
• Three strategies that can be adopted for finding the conceptual
classes.
1.Reuse or modify existing models
2.Use of category list.
3.Finding out the name phrases from the problem description .
Example : ATM System
Attributes
• Attributes is a logical data values of an object. It is necessary to
identify the attributes of conceptual classes so that information
required by the system can be represented .
• For example:
• Customer needs ID
• Account has account type
• Flight has date / Time
• Student has name and address
Attributes and derived attributes
Flight
+Name :Flight name
-/Date Time :Date
Relationships
• Various relationships in class diagram are :
1.Associations
2.Inhertiance
3.Aggregation
4.composition
Associations
• The association is the most common type of relationship used UML.
The association is shown between the classes or instance of classes

Customer Account
+type
+Name +Branch name
+AccNumber
When to show an Association ?
• The association relationship is used in the system design when we
want that the relation between two object has to remembered for
some time
• It can be defined from the common association list.
How to represent Association in UML ?
Using the simple association name like has or uses leads to less
understanding of the domain model.
1.A uses B 2.A has B 3.A is a member of B 4.A records B
5.A issues / Return B 6.A communicates with B
7.A is followed by B 8.A is owned by B
Examples:
librarian Library card
What is multiplicity in an association
Notations Description
1 Only one instance
0.1 Zero or one instance
* Many instance
0..* Zero or Many instance

1..* One or Many instance

2..10 You can specify the integer range


How to find association with common list?

Category Example
A and B are transactions and they are Reservation is related to the confirmation of reservations
related with each other
A is a role and B is transaction Customer makes the payment
Librarian issues BooK
Librarian issues Library card
A is logical or physical part Of B Customer has library card
A is logically or physically contained Book is present in shelf
with in B

A is a member of B Student is a member of library


A uses/ manages / owes B Customer uses Account
Inheritance
• Inheritance or Generalization is the procedure in which one class
inherits the attributes and methods of another class. The class whose
properties and methods are inherited is known as the parent class or
superclass. And the class that inherits the properties from the parent
class is the child class or derived class.
• It is represented by
Examples
Tests
+name
+date
+time
+class
+marks
+status()

Monthly Test Annual Test


Aggregation and composition
• Both are of kind of associations.
• Aggregation :
It is used to represent the whole part relation ship. It is denoted as

Example:
DVD player
car
composition
• It is a special kind of aggregation which represents the whole part
relationship .To be more specific a restricted aggregation is called
composition.
• It is represented by

Example:

car Steering
Visibility
• The visibility specifies the how the attributes and operations are
visible in the system.
• There are four level
1.Public 2.protected 3.private 4.package
Transaction
-session
-card no
-pin
+time
+Create transaction()
+perform transaction()
#getmessades()
-reconfigure()
Qualified Association
• The qualified association has qualifier which is used to select
particular object from the set of objects

course Student
Student ID : int
Association class
• The abstract class is a class that allows the association to be a class
itself
• Example: Course
Student -Course Name
-Name -course ID
-stud ID -Fee
-Address
+Check _Eligibility() +Allocate _Student ()
+Select course() +cancel _Allocation()
+update _course

Enrollment
-marks
+calculate _Avg_ Marks()
Singleton class
• When there is a situation that only one instance of a class is
instantiated then it is called singleton instance.
Service Resources
Underlined object indicates
+instance: Service Resource that it is a static member
-getInsurance ():Service Resource
Active class
• An active class indicates that when instantiated the class controls its
own execution .
<<interface>> Command processor

Run ( )
Run ()
When to use class diagram?

1.For modelling the vocabulary of the system the class diagram is used
2. For modelling the collaboration of the system the class diagram is
used
3.For Modelling the logical database schema the class diagram is used.
Interaction Diagram
• It are created to represent interactive behavior of the elements of the
system.
• 2 types
• 1.sequence diagram 2.communication or collaboration diagram
Relationship between sequence diagram
and use case diagram
Collaboration diagram
• The collaboration diagram is used to show the relationship between
the objects in a system. Both the sequence and the collaboration
diagrams represent the same information but differently.
• Instead of showing the flow of messages, it depicts the architecture of
the object residing in the system as it is based on object-oriented
programming. An object consists of several features.
• Multiple objects present in the system are connected to each other. The
collaboration diagram, which is also known as a communication
diagram, is used to portray the object's architecture in the system.
Activity Diagram
• An activity diagram is a type of Unified Modeling Language (UML)
flowchart that shows the flow from one activity to another in a system
or process.
• It's used to describe the different dynamic aspects of a system and is
referred to as a 'behavior diagram' because it describes what should
happen in the modeled system.
State chart Diagrams
• UML State Machine diagram represents the events and states of
object and the behavior of object in reaction to an event.
Events, states and transitions
Event : An event is significant occurrence of something
States: A state is a condition of object at a particular moment of time.
Transitions: The relationship between the two states is indicated using
the transition.
Example
Applying state machine diagram
• If the object responds to the same way to event then that object is
considered as state independent with respect to that event .
Guidelines about state dependant and independent objects
A list of common objects used in state model diagram is :
1.Complex reactive objects
2.Protocals
3.Legal sequences
Nested states
When to use state diagram
•  Used to model the dynamic aspects of a system
• Used in context of the system as a whole
•  It is used to model reactive objects.
• It is used to model various states of the objects.
Functional modelling
• In function –oriented design , the design of software system is divided
into various interacting units.
• Various modes that can be created in function –oriented design are
1.Data flow models 2.Data dictionaries
3.Structure charts
Data Flow Diagram
• The structured the system analysis is a technique in which the system
requirments are converted into computer programs, hardware
configurations and related manual procedure .
• The system can be modeled using:
Entity relationship diagram are used to represented the data model
data flow diagram which is used to represent the functional model.
. DFD represents the flow of information for any process or system.
Rules for Designing DFD

You might also like