Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1
Course description:
OBJECTIVE:
The understand the Unified Modeling Language and orient towards
Object Oriented methodology using UML for modeling software
systems.
TARGET AUDIENCE:
In particular, it is intended for software professionals who have sound
knowledge of object concepts and some experience towards analysis
and design.
PREREQUISITES:
Good understanding of object concepts.
Sound knowledge of any object oriented language.
Knowledge of software engineering process.
2
Course description:
TABLE OF CONTENTS:
Module1 Introduction
Module2 Use case diagram
Module3 Flow of events
Module 4 Realization of the class diagram
Sequence diagram and Collaboration Diagram
Module5 Class diagram and refinement attributes
Module6 State transition and activity diagram
Module7 Implementation diagram
Component diagram and Deployment diagram
Module8 Understanding project culture
Appendix-A
3
Module-1
4
Importance of modeling
What is a model?
– A model is a simplification of reality
Why do we model?
– help visualizing
– permit specification
– provides a template
– document decisions
5
4 Principles of Modeling
Choose your models well
Every model may be expressed at various
levels of precision
The best models are connected to reality
No single model is sufficient
6
What is Software Engineering?
DEFINITION:The application of systematic, disciplined and
qualifiable approach to the development, operation and maintenance of
a software system is software engineering.
Software development life cycle has following stages:
REQUIREMENT
ANALYSIS
DESIGN
IMPLEMENTATION
TESTING 7
Effort Distribution for each stage:
Analysis & design 40 %
Development 20 %
Testing 40 %
8
Major benefits of OOAD:
The object oriented approach is a way of thinking about a problem using
real world concepts instead using adhoc function concepts.
9
Elements of OO Methodology:
Following are three elements for every OO methodology:
Notation
Process / Method
Tool
10
What is Notation?
Notation:
It is collection of graphical symbols for expressing model of the
system.
The Unified Modeling Language [UML] provides a very robust set
of notation which grows from analysis to design.
This brings end of the method wars as far as notation is concerned
with adoption of the language [UML]
Systems software
Business processes
13
The Evolution of the UML:
OMG vote’97
Public Feedback Submission to OMG, sept’97 UML1.1
UML0.9
15
UML refers to:
UML things:
Class, component, node, relationship, package etc..
UML diagrams:
Use case diagram, interaction diagram, class diagram, State
diagram,deployment diagram
16
What is Process?
What is Process?
17
More about Process?
Guidance as to the order of team’s activities
It specifies what artifacts should be developed
It directs the task of individual developers and team as a whole
It offers criteria for monitoring and measuring project activities
The selection of particular process will vary greatly depending upon
things like problem domain, implementation technology and skills of
team
Booch,OMT,OOSE and many other methods have well defined
process and UML supports almost all methods
There has been some convergence on development process practices
but there is no consensus for standardization.
Framework for the every stage of software development life cycle.
18
Best Practices followed by Rational Unified Process
19
What is a tool?
It is automated support for every stage of software development
life cycle.
1. Rational Rose
2. Cayenne
3. Platinum
4. Select
20
Why Tool?
21
Triangle for Success:
All three components play equally important role towards the success
of the project.
Notation
Tool
Method
22
Objective of the first module:
Get introduced with Unified Modeling Language and know the basic
components of software development life cycle.
23
Module-2
24
OO model:
DYNAMIC MODEL
STATIC MODEL
LOGICAL MODEL
PHYSICAL MODEL
25
Models and Views:
26
UML diagrams:
Use case diagrams represent the functions of a system from the user’s
point of view.
Sequence diagrams are a temporal representation of objects and their
interactions.
Collaboration diagrams are a spatial representation of objects, links,
and interactions.
Object diagrams represent objects and their relationships, and
correspond to simplified collaboration diagrams that do not represent
message broadcasts.
Class diagrams represent the static structure in terms of classes and
relationships.
28
Semantics of Diagrams:
Contd...
State chart diagrams represent the behavior of a class in terms of states
Activity diagrams are to represent the parallel behavior of an operation
as a set of actions.
Component diagrams represent the logical components of an
application.
Deployment diagrams represent the deployment of components on
particular pieces of hardware.
29
What is USE CASE diagram?
30
ACTOR:
What is an actor?
An actor is some one or something that must interact with the system
under development
UML notation for actor is stickman, shown below.
32
ACTOR:
Contd…
Those are responsible for its use and maintain as well as other systems
that interact with the developed system.
An actor may
- input information to the system.
- receive information from the system.
- input to and out from the system.
33
ACTOR:
Actor is always external to the system. They are never part of the
system to be developed.
34
ACTOR:
4-Categories of an actor:
35
ACTOR:
Note:
36
USE CASE:
38
USE CASE:
Contd…
39
USE CASE:
40
USE CASE:
42
Grouping USE CASES:
43
OOAD --- USE CASE driven
44
SYSTEM BOUNDARY:
It is shown as a rectangle.
It helps to identify what is external verses internal, and what the
responsibilities of the system are.
The external environment is represented only by actors.
45
RELATIONSHIP:
What is Relationship?
<< >>
46
RELATIONSHIP:
USES:
- Multiple use cases share a piece of same functionality.
- This functionality is placed in a separate use case rather than
documenting in every use case that needs it.
47
RELATIONSHIP:
Contd...
A uses relationship shows behavior that is common to one or
more use cases.
EXTENDS:
It is used to show optional behavior, which is required only
under certain condition.
48
USE CASE diagram:
Use case diagram for the shown functionality.
Balance status
report
extends
Validation
ATM
Manager
49
Objective of the second module
50
Module-3
51
Beginning Analysis and Design
52
Flow of Events:
A flow of events document is created for each use case.
Details about what the system must provide to the actor when the use
is executed.
Typical contents
– How the use case starts and ends
– Normal flow of events
– Alternate flow of events
– Exceptional flow of events
Typical Course of Events has:
Actor Action(AA)
System Response(SR)
53
Normal Flow of Events:
54
Normal Flow of Events:
Contd...
9.(SR)The ATM asks for the amount of cash; user enters Rs. 2500/-
10.(SR)The ATM verifies that the amount of cash is within predefined
policy limits and asks the bank, to process the transaction which
eventually confirms success and returns the new account balance.
11.(SR) The ATM dispenses cash and asks the user to take it.
12.(AA) The user takes the cash.
13.(SR) The ATM asks whether the user wants to continue.
14.(AA) The user indicates no.
55
Normal Flow of Events:
Contd...
15.(SR) The ATM prints a receipt, ejects the card and asks the user to
take them
16.(AA) The user takes the receipt and the card.
17.(SR) The ATM asks a user to insert a card.
56
Alternative Flow of Events:
57
Exceptional Flow of Events:
58
Why flow of events?
59
What is Scenario?
60
Objective of the third module
To understand the flow of each functionality and find out the objects
and methods required to build the system.
61
Module-4
62
USE CASE Realizations:
63
What is Interaction diagram?
64
What is sequence diagram?
65
OBJECT & OBJECT LIFE LINE:
66
MESSAGES:
The sender will send the message and receiver will receive the
message.
67
MESSAGES:
Contd…
May have square brackets containing a guard conditions. This is a
Boolean condition that must be satisfied to enable the message to be
sent.
May have have an asterisk followed by square brackets containing an
iteration specification. This specifies the number of times the message
is sent.
May have return list consisting of a comma -separated list of names
that designate the values of returned by the operation.
Must have a name or identifier string that represents the message.
May have parentheses containing an argument list consisting of a
comma separated list of actual parameters passed to a method.
68
Sequence diagram [for withdrawal of cash, normal flow]
Terminate
Print receipt ,eject card
Request take card
Take card 69
Display main screen and prompt for the card.
What is Collaboration diagram?
70
Components of collaboration diagram:
Named objects
Links: Links are represented by a continuous line between objects, and
indicates the exchange of messages.
Messages has following attributes:
• Synchronization --thread name, step within thread.
• Sequence number
• Message labels : The name of the message often corresponds to an operation
defined in the class of the object that is the destination of the message.
Message names may have the arguments and return values.
• *[iteration].
• It uses decimal notation.
• Message direction.
71
Semantics of components:
Object names identify which objects are participating and the links
show which objects collaborate
A link between two objects must exist for one object to send message
to another and vice a versa.
Messages in the collaboration diagram get transformed to more
detailed signature.
They use the decimal notation system for numbering the messages.
The direction of the message defines the sender and receiver of
the message
72
The elements of message:
Predecessor
Role names
Message qualifiers
– Iteration expression
– Parameters
– Return values
– Guard
– Message stereotypes
Concurrent thread sequencing
Thread dependencies
Message expression
[Pre] A1:*(expression):doIt(p,r):return value
73
The examples of message:
4:Display(x,y) Simple
message
3.3.1:Display(x,y) Nested
message
4.2:subtract[Today,Birthday]:age Nested
message with
return value
[Age >=18] 6.2:Vote() Conditional
message
4.a,b.6/c.1:Turnon(Lamp) Synchro. with
other flow of
execution
1*:wash() Iteration
3.a,3.b/4*||[i:=1..n]:Turnoff() Parallel
iteration
74
Collaboration diagram [for withdrawal of cash, normal flow.]
1. Insert card
Enter password, Enter kind
Enter amount,
Take cash, Take card
cancel,Terminate, Continue Create Transaction
Transaction complete
CUST- TRANSA-
OMER Display main screen
unreadable card message,
ATM CTION
request password,
request kind, request amount,
canceled message, eject card, failure message,
dispense cash, request take cash Transaction succeed
request continuation, Transaction failed
print receipt, request take card account o.k.
bad account message, Verify account, bad account,
bad bank account message process transaction bad password,
bad bank code
BANK
75
Objective of the fifth module
76
Module-5
77
What is Class diagram?
A class diagram shows the existence of classes and their relationships
in the logical view of a system
78
Major Types of classes:
Concrete classes
A concrete class is a class that is instantiable; that is it can have
different instances.
Only concrete classes may be leaf classes in the inheritance tree.
Abstract classes
An abstract class is a class that has no direct instance but whose
descendants classes have direct instances.
An abstract class can define the protocol for an operation without
supplying a corresponding method we call this as an abstract
operation.
An abstract operation defines the form of operation, for which each
concrete subclass should provide its own implementation.
79
RELATIONSHIP:
Association
Aggregation
Composition
Inheritance
Dependency
Instantiation
80
ASSOCIATION:
CUSTOMER
ATM system
81
AGGREGATION:
82
AGGREGATION:
Example:
83
COMPOSITION:
84
INHERITANCE:
CurrentAccount SavingAccount
85
DEPENDENCY:
Client Server
86
INSTANTIATION
Queue<int>
87
What is Cardinality? :
This complete procedure brings the minimal class diagram [for withdraw cash
use case, normal flow.]
89
Class diagram [for withdrawal of cash, normal flow]
Customer
1
1..*
1..*
ATMSystem
0..*
Transaction 1
1
1..* Bank[Branch]
1
90
What more to the Class Diagram?
Till this slide we have worked out the essentials of class diagram for
withdrawal of cash use case, normal flow of events.
Similar exercise required to be carried out for every scenario and
clubbed all in the class diagram.
At this point, we refine this integrated class diagram to add further fine
details. Approximate sketch for this class diagram has been shown at
the end of this module.
Refinement attributes should be updated right from sequence diagram
to class diagram.
Next few slides will take into the discussion of refinement attributes.
This process of iterative and incremental development will continue till
there is no change in two consecutive iteration.
91
OOAD---Iterative & Incremental Approach
Identify objects
Group Objects
Group classes into classes
into domains
Stereotypes:
It permits user to add new model element classes on top of the kernel
predefined by UML
93
Refinement attributes:
Contd…
Constraints:
Constraints are functional relationship between the entities and object
model. The entities include objects, classes, attributes, association,
links.
A constraint restricts the values that entities can assume.
UML doesn't specify a particular syntax for constraints, other than they
should appear between braces, so they may therefore be expressed
using natural language, pseudo code, navigation expression or
mathematical expression
UML1.2 does prefer the use of a constraint language OCL i.e. Object
Constraint Language, which is subset of UML.
94
Refinement attributes:
Example:Constraints
Number of withdrawal transaction should be less than five per day.
Constraint on the same class.
Transaction
Qualifier:
UML provides a role of constraint notation to indicate different kind of
collections that may be inherent in the analysis model
96
Refinement attributes:
Qualifier:
Another common design scheme is to use a key value to retrieve an
item from the collection. This is called as qualified association and the
key value as qualifier.
A qualified association is the UML equivalent of a programming
concept variously known as associative arrays, maps,dictionaries
A qualified association relates two object classes and a qualifier
The qualifier is a special attribute that reduced the effective
multiplicity of an association.
One to many and many to many association may be qualified.
97
Refinement attributes:
98
Objective of the fifth module:
99
Refined Class diagram [for withdrawal of cash]
1..* Cash
BankComputer
1
Bank[Branch]
<<abstract>>
AccountAccessor
1 1 <<abstract>>
person
Transaction
CashierStation
1..*
1 ATMScreen
Slips Customer BankAssociates
1..*
1
<<abstract>> TellerScreen
Account
1 0..1
BankCard NoteHelpForBankCard
1
CurrentAccount SavingAccount
100
Module-6
101
What is state transition diagram?
102
Semantics of every components:
State: A state is a condition during the life of an object when it
satisfies some condition, performs some action, or waits for an event.
The UML notation for a state is a rectangle with rounded corners.
103
Semantics of every components:
Contd...
State transition: A state transition represents a change from an
originating to a successor state.
Transition label: event name[guard condition] / action
104
State Transition Diagram [for Account class. ]
request and fill the form for new saving account[ validate ] / process
Open
Dormant
no transaction / Transfer_to_Dormant_Ledger
close
seized
fill_the_request_form / update()
105
More about State Diagram:
A state diagram will not be created for every class.
state diagrams are used only for those classes that exhibit interesting
behavior.
State diagrams are also useful to investigate the behavior of user
interface and control classes.
State diagram are used to show dynamics of a individual class
106
What is activity diagram?
It is a special kind of state diagram and is worked out at use case level.
These are mainly targeted towards representing internal behavior of a
a use case.
These may be thought as a kind of flowchart.
Flowcharts are normally limited to sequential process; activity
diagrams can handle parallel process.
Activity diagrams are recommended in the following situations:
Analyzing use case
Dealing with multithreaded application
Understanding workflow across many use cases.
107
Consistency Checking
108
Objective of the sixth module
109
Module-7
110
What is component diagram?
COMPONENT DIAGRAM:
A component may be
• A source code component
• A run time components
• An executable component
• Dependency relationship.
111
Component Diagram [for withdrawal of cash]
policy.dll
Bank
Server.exe
Branch
customer.dll Bank.dll
Branch
Bank.exe
ATM.exe
112
What is deployment diagram?
113
Deployment diagram
Branch
Bank_
Bank.exe
Ethernet
Ethernet
Bank_
ATM_ server
machine
BankServer.exe
ATM.exe
114
Objective of the seventh module:
115
Module-8
116
Understanding the project culture
It may be:
1.Calendar Centric
2.Requirement Centric
3.Documentation Centric
4.Quality Centric
5.Architecture Centric
117
Understanding the project’s culture
119
OOAD---Architecture Centric
120
ESSENCE OF OOAD AND UML
121
Desire for good Architecture
122
Basic Structural Modeling
Object-Oriented Programming
Aline Yurik
123
Classes and Types
Class is a user-defined type
They can be used as built-in types
Objects are variables
Objects can contain other objects
124
Two Views of a Class
customer
Interface (outside view)
LName
– specification of FName
operations Address
– hides structure and ID
implementation GetName( )
Implementation (inside GetAddress( )
view) customer
– state information Database pointer
– all details ID
– can change without GetName( )
affecting interface GetAddress( ) 125
Multiple Implementations
A single interface may Examples:
have multiple Complex Numbers
implementations – Cartesian coordinates
Implementations can – Polar coordinates
be changed without Set Representation
changing interfaces – array
Implementations can – linked list
be improved without – hash table
affecting rest of Sort Algorithms
system – insertion sort 126
– quick sort
Polymorphism
Instances of classes Person
with superclasses are
polymorphic
Employee
They have more than
one type
Manager
Chris
127
Polymorphic Operations
Operations defined for
arguments of a class Person
type also accept
arguments of subclass Employee
type
Operation
Manager
marry(Person)
– expects an arguments
of type Person
– also accepts Employee
128
or Manager
Class Modeling Notation
change-job
change-address
(Person)
Mary Sharp
52
129
Class Modeling Notation - cont.
Class-Name
operation-name-1(argument-list-1): result-type-1
operation-name-2(argument-list-2): result-type-2
…
130
Class Relationships
Relationships are connections between
classes
Dependencies
– one class uses another
Generalizations
– connect generalized classes to more specialized
ones
Associations
– structural relationships among instances 131
Example: Relationships
Window
Generalization Generalization
132
Dependency
“Using” relationship
Change in one class may effect another
One class may use another as an argument in an
operation
FilmClip
name
Channel
playOn(c : Channel)
start()
stop()
reset()
133
Generalization
Relationship between Child may inherit
a general class and a some or all attributes
more specific class and operations of
General class: parents
– super-class, parent Child may have its
Specific class: own attributes and
– subclass, child functions
is-a relationship Single parent - single
– is-a-kind-of inheritance
Child inherits More than one parent -
properties of parents multiple inheritance 134
Example: Generalization
Shape
origin
move()
resize()
display()
display()
Square 135
Is-a Relationships
Superclasses and Subclasses
Classes are related via Superclasses (base
is-a relationships classes)
– employee is-a person – more general classes
– manager is-a employee – Person is a superclass
– car is-a vehicle of Employee
– truck is-a vehicle Subclasses (derived
classes)
– more specialized
classes
– Manager is a subclass
136
of Employee
Example: Superclasses and
Subclasses
Person
Employee Student
Manager
137
Inheritance (is-a relationship)
Bank account
balance
holder
account #
list of deposits
list of withdrawals
deposit(amt)
withdraw(amt)
balance?
transactions?
140
Association
Structural relationship
How objects are connected to each other
Binary association
– between two classes
Unary association
– within the same class
N-ary association
– multiple classes 141
Association Attributes
Name and direction
– e.g., works for
Works for
Person Company
Role
– what role each class plays
Person Company
+employee +employer
142
Association Attributes - cont.
Multiplicity
– how many object are involved on each side of the
association
Person 1..* * Company
+employee +employer
Aggregation Company
– whole/part relationship
1
*
Department
143
Aggregation: a-part-of
Relationship
1 * 1 *
document paragraph sentence
microcomputer
1
* 0..1
monitor system box mouse keyboard
* 0..1
chassis CPU RAM fan
144
Aggregation and Generalization
Aggregation lamp
– several components
make up an aggregate base shade switch
– a-part-of relationship
Generalization
lamp
– superclasses and
subclasses
– is-a relationship fluorescent incadescent
lamp lamp
145
Abstract vs. Concrete Class
Abstract class employee
– has no direct instances year-to-date earnings
compute pay {abstract}
– subclasses have direct
instances
– logical superclass
hourly employee salaried employee
Concrete class hourly rate weekly rate
– has direct instances overtime pay
compute pay compute pay
146
Modeling Simple Dependencies
Connection between a class and another
class, used as a parameter in an operation
CourseSchedule
Course
add(c : Course)
remove(c : Course)
<<friend>>
Iterator
147
Modeling Single Inheritance
Put common attributes and operations in the
general class Security
presentValue()
history()
SmallCapStock LargeCapStock
148
Modeling Structural
Relationships
Has
School Department 0..1
1 1..*
1..* 1..* 1..*
assignedTo
member
1..* +chairperson
* 1..* 0..1
attends teaches
Student Course Instructor
* * * 1..*
149
Multiple Inheritance
Class can inherit features from more than
one superclass
Feature from the same ancestor found
among multiple paths is inherited once
Any ambiguities should be resolved in
implementations
– need to explicitely spell out which feature to
use
150
Example: Multiple Inheritance
vehicle
151
Example: Multiple Inheritance
Brand X Brand Y
Computers
Products Products
Brand X Brand Y
Computers Computers
152
Structural Diagrams
Class Diagram
– shows classes, interfaces, collaborations and
their relationships
Object Diagram
– shows objects and their relationships
Component Diagram
– shows components and their relationships
Deployment Diagram
153
– shows nodes and their relationships
Diagrams
Structural Diagrams: Behavioral Diagrams:
Class diagrams Use case diagrams
Object diagrams Sequence diagrams
Component diagrams Collaboration
Deployment diagrams diagrams
State chart diagrams
154
Class Diagrams
Contents: Common Uses:
Classes Model vocabulary of a
Interfaces system
Collaborations Model simple
Relationships
collaborations
– dependency Model logical
– generalization database schema
– association
155
Example: Class Diagram
Company
*
Office
Department Location
address : String
name : Name
0..1 voice : Number
* *
* *
Person
name : Name
employeeID : Integer ContactInfo
title : String address : String
getPhoto(p : Photo)
getSoundBite()
getContactInfo() PersonnelRecord
getPersonalRecords() taxID
employmentHistory 156
salary
ISecureInfo
Modeling Simple Collaborations
CollisionSensor
Collaboration: PathAgent
1 *
Identify classes,
interfaces that Motor
participate in move(d : Direction, s : Speed)
collaboration stop()
resetCounter()
Use scenarios status() : Status 157
distance() : Integer
Modeling a Logical Database
Schema
Class diagrams are a superset of entity
relationship diagrams used for DB modeling
Identify classes representing DB data as
persistent
Avoid cyclic, 1-to-1 and N-ary associations
– create intermediate classes to simplify structure
Move business rules to a layer of classes
separate from persistent classes
158
Example: Modeling a Schema
<<persistent>>
School
name : Name
address : String <<persistent>>
phone : Number Department
Has name : Name 0..1
addStudent()
removeStudent() addInstructor()
1 1..*
getStudent() removeInstructor()
getAllStudents() getInstructor()
AssignedTo
addDepartment() getAllInstructors()
1..*
removeDepartment() 0..1 +chairperson
1..*
getDepartment() 1..* <<persistent>>
getAllDepartments()
Instructor
1..* name : Name
Member
Teaches
* 1..* 1..*
<<persistent>> <<persistent>>
Student Attends Course *
name : Name name : Name
studentID : Number * * courseID : Number 159
Appendix-A
160
Strong recommendation
Object Technology
– David A. Taylor
Object Oriented Analysis and design with Applications
– Grady Booch
UML distilled
–Martin Fowler
Instant UML
– Pierre - Alain Muller
Software Engineering
– Roger S Pressman
161
REFERENCES
Contd...
Object Oriented Modeling and Design
– James Rumbaugh
Object Oriented Software Engineering
– Ivar Jacobson
Clouds to code
– Jesse Liberty
Applying use cases
– Geri Schneider
–Jason p. Winters
UML Toolkit
– Hans-Eriksson and Magnus Penker Version1.1
162
THANK-U!
163