Introduction to OOA and UML

Shwetha-BA 1,405 views 77 slides Aug 15, 2018
Slide 1
Slide 1 of 77
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77

About This Presentation

In this Business Analysis training session, you will learn about Introduction to OOA and UML. Topics covered in this session are:
• Elements, purpose and example of UML Diagrams :
• Use Case Diagram
• Class Diagram
• Sequence Diagram
• Collaboration Diagram
• State Diagram
• Activity D...


Slide Content

Business Analysis
Training
Introduction to OOA and UML

Page 2Classification: Restricted
Agenda
•Elements, purpose and example of UML Diagrams :
•Use Case Diagram
•Class Diagram
•Sequence Diagram
•Collaboration Diagram
•State Diagram
•Activity Diagram

Page 3Classification: Restricted
Introduction

Page 4Classification: Restricted
Why Do We Need Object Oriented
Analysis or a Structured Analysis?

Page 5Classification: Restricted
Stated vs Un-Stated

Page 6Classification: Restricted
Another Example

Page 7Classification: Restricted
Software Projects (2012 Report)
Waterfall
Successful
Challenged
Failed
Agile
Successf
ul
Challeng
ed
Failed
Source: Standish Chaos Report (2012)
How Successful are Our Projects?

Page 8Classification: Restricted
Where does it go wrong?

Page 9Classification: Restricted
Software Analysis and Design

Page 10Classification: Restricted
Modeling
•Describing a system at a high level of abstraction
–A model of the system
–Used for requirements and specifications
•Is it necessary to model software systems?

Page 11Classification: Restricted
What is UML?
•UMLstandsfor“UnifiedModelingLanguage”
•Itisaindustry-standardgraphicallanguageforspecifying,visualizing,
constructing,anddocumentingtheartifactsofsoftwaresystems
•TheUMLusesmostlygraphicalnotationstoexpresstheOOanalysisand
designofsoftwareprojects.
•Simplifiesthecomplexprocessofsoftwaredesign

Page 12Classification: Restricted
Why UML for Modeling
•Usegraphicalnotationtocommunicatemoreclearlythannatural
language(imprecise)andcode(toodetailed).
•Helpacquireanoverallviewofasystem.
•UMLisnotdependentonanyonelanguageortechnology.
•UMLmovesusfromfragmentationtostandardization.

Page 13Classification: Restricted
Overview of UML Diagrams
OverviewofUMLDiagrams
Structural
: element of spec. irrespective of time
oClass
oComponent
oDeployment
oObject
oComposite structure
oPackage
Behavioral
: behavioral features of a system / business
process
oActivity
oState machine
oUse case
oInteraction
Interaction
: emphasize object interaction
oCommunication(collaborati
on)
oSequence
oInteraction overview
oTiming

Page 14Classification: Restricted
Types of UML Diagrams
•Use Case Diagram
•Class Diagram
•Sequence Diagram
•Collaboration Diagram
•State Diagram
This is only a subset of diagrams … but are most widely used

Page 15Classification: Restricted
Use Case Diagram
•Usedfordescribingasetofuserscenarios
•Mainlyusedforcapturinguserrequirements
•Worklikeacontractbetweenenduserandsoftwaredevelopers

Page 16Classification: Restricted
Use Case Diagram (core components)
Actors:Arolethatauserplayswithrespecttothesystem,includinghuman
usersandothersystems.e.g.,inanimatephysicalobjects(e.g.robot);an
externalsystemthatneedssomeinformationfromthecurrentsystem.
Usecase:Asetofscenariosthatdescribinganinteractionbetweenauser
andasystem,includingalternatives.
Systemboundary:rectanglediagramrepresentingtheboundarybetween
theactorsandthesystem.

Page 17Classification: Restricted
Use Case Diagram (core relationship)
Association:communicationbetweenanactorandausecase;
Representedbyasolidline.
Generalization:relationshipbetweenonegeneralusecaseanda
specialusecase(usedfordefiningspecialalternatives)
Representedbyalinewithatriangulararrowheadtowardtheparent
usecase.

Page 18Classification: Restricted
Generalization

Page 19Classification: Restricted
Use Case Diagram (core relationship)
Include:adottedlinelabeled<<include>>beginningatbaseusecaseand
endingwithanarrowspointingtotheincludeusecase.Theinclude
relationshipoccurswhenachunkofbehaviorissimilaracrossmorethanone
usecase.Use“include”insteadofcopyingthedescriptionofthatbehavior.
<<include>>
Extend:adottedlinelabeled<<extend>>withanarrowtowardthebasecase.
Theextendingusecasemayaddbehaviortothebaseusecase.Thebaseclass
declares“extensionpoints”.
<<extend>>

Page 20Classification: Restricted
Use Case Diagram (core relationship)

Page 21Classification: Restricted
Use Case Diagram (core relationship)

Page 22Classification: Restricted
Use Case Diagrams
Library System
Borrow
Order Title
Fine Remittance
Client
Employee
Supervisor
Boundary
Actor
Use Case

Page 23Classification: Restricted
Use Case Diagrams

Page 24Classification: Restricted
Types of Actor
Actors
Primary
Actor
Secondary Actor

Page 25Classification: Restricted
Types of Actor

Page 26Classification: Restricted
Exercise

Page 27Classification: Restricted
Use Case Specification

Page 28Classification: Restricted
Exercise

Page 29Classification: Restricted
Use Cases for the Exercise

Page 30Classification: Restricted
Actors for the Exercise

Page 31Classification: Restricted
Relationship between the actors

Page 32Classification: Restricted
•Usedfordescribingstructureandbehaviorintheusecases
•Provideaconceptualmodelofthesystemintermsofentitiesandtheir
relationships
•Usedforrequirementcapture,end-userinteraction
•Detailedclassdiagramsareusedfordevelopers
Class diagram

Page 33Classification: Restricted
A collection of similar objects is a class. And an object is an instance of a class.
What is a Class?

Page 34Classification: Restricted
Class representation
•Eachclassisrepresentedbyarectanglesubdividedintothree
compartments
•Name
•Attributes
•Operations
•Modifiersareusedtoindicatevisibilityofattributesandoperations.
•‘+’isusedtodenotePublicvisibility(everyone)
•‘#’isusedtodenoteProtectedvisibility(friendsandderived)
•‘-’isusedtodenotePrivatevisibility(noone)
•Bydefault,attributesarehiddenandoperationsarevisible.

Page 35Classification: Restricted
An example of Class
Account_Name
-Customer_Name
-Balance
+addFunds( )
+withDraw( )
+transfer( )
Name
Attributes
Operations

Page 36Classification: Restricted
•Super Class
•Parent Class
•Generalized Class
•Specialized Class
•Sub Class
•Child Class
Types of Classes

Page 37Classification: Restricted
Animal
Amphibian
Mammal
Reptile
Horse
Example
Child Class
of Animal
Child Class
of Animal
Child Class
of Mammal
Super Class
of horse
Parent Class
of Mammal
Sub Class of
Animal

Page 38Classification: Restricted
OO Relationships
•TherearetwokindsofRelationships
•Generalization(parent-childrelationship)
•Association(oneobjecttoanotherobjectrelationship)
•Associationscanbefurtherclassifiedas
•Aggregation
•Composition

Page 39Classification: Restricted
OO Relationships : Generalization
Subtype2
Supertype
Subtype1
•Generalizationexpressesa
parent/childrelationship
amongrelatedclasses.
•Usedforabstractingdetailsin
severallayers
Regular
Customer
Loyalty
Customer
Customer
Example
:
Regular
Customer
Loyalty
Customer
Customeror:

Page 40Classification: Restricted
OO Relationships : Association
•Represent relationship between instances of classes
•Student enrolls in a course
•Courses have students
•Courses have exams
•Etc.
•Association has two ends
•Role names (e.g. enrolls)
•Multiplicity (e.g. One course can have many students)
•Navigability (unidirectional, bidirectional)

Page 41Classification: Restricted
University Person
1
0..1
*
*
Multiplicity
Symbol Meaning
1 One and only one
0..1 Zero or one
M..N From M to N (natural language)
* From zero to any positive integer
0..* From zero to any positive integer
1..* From one to any positive integer
teacheremployee
Role
“A given university groups many people;
some act as students, others as teachers.
A given student belongs to a single
university; a given teacher may or may not
be working for the university at a particular
time.”
student
Association: Multiplicity and Roles

Page 42Classification: Restricted
Class Diagram

Page 43Classification: Restricted
OO Relationships : Composition
Class W
Class P
1
Class P
2
Whole Class
Part Classes
Automobile
Engine Transmission
Example
Composition:expressesarelationshipamonginstancesof
relatedclasses.ItisaspecifickindofWhole-Part
relationship.
Itexpressesarelationshipwhereaninstanceofthe
Whole-classhastheresponsibilitytocreateandinitialize
instancesofeachPart-class.
Itmayalsobeusedtoexpressarelationshipwhereinstances
ofthePart-classeshaveprivilegedaccessorvisibilityto
certainattributesand/orbehaviorsdefinedbytheWhole-
class.
Compositionshouldalsobeusedtoexpressrelationship
whereinstancesoftheWhole-classhaveexclusiveaccessto
andcontrolofinstancesofthePart-classes.
Compositionshouldbeusedtoexpressarelationshipwhere
thebehaviorofPartinstancesisundefinedwithoutbeing
relatedtoaninstanceoftheWhole.And,conversely,the
behavioroftheWholeisill-definedorincompleteifoneor
moreofthePartinstancesareundefined.
[From Dr.DavidA. Workman]

Page 44Classification: Restricted
OO Relationships : Composition
[From Dr.DavidA. orkman]
Class C
Class E
1
Class E
2
AGGREGATION
Container Class
ContaineeClasses
Bag
Apples Milk
Example
Aggregation:expressesarelationshipamong
instancesofrelatedclasses.Itisaspecifickindof
Container-Containeerelationship.
Itexpressesarelationshipwhereaninstanceof
theContainer-classhastheresponsibilitytohold
andmaintaininstancesofeachContainee-class
thathavebeencreatedoutsidetheauspicesofthe
Containerclass.
Aggregationshouldbeusedtoexpressamore
informalrelationshipthancompositionexpresses.
Thatis,itisanappropriaterelationshipwherethe
ContaineranditsContaineescanbemanipulated
independently.
AggregationisappropriatewhenContainerand
Containeeshavenospecialaccessprivilegesto
eachother.

Page 45Classification: Restricted
Aggregations vs. Composition
•Compositionisreallyastrongformofaggregation
•componentshaveonlyoneowner
•componentscannotexistindependentoftheir
owner
•componentsliveordiewiththeirowner
e.g.Eachcarhasanenginethatcannotbe
sharedwithothercars.
•Aggregationsmayform"partof"theaggregate,butmaynotbe
essentialtoit.Theymayalsoexistindependentoftheaggregate.
e.g.Applesmayexistindependentofthebag.

Page 46Classification: Restricted
Interaction Diagrams
A Sequence diagram is an interaction diagram that shows how objects
operate with one another and in what order.
•They're also called event diagrams.
•A sequence diagram is a good way to visualize and validate various
runtime scenarios.
•These can help to predict how a system will behave and to discover
responsibilities a class may need to have in the process of
modeling a new system

Page 47Classification: Restricted
Sequence Diagrams

Page 48Classification: Restricted
Class Roles or Participants
Class roles describe the way an object will behave in context. Use the UML
object symbol to illustrate class roles, but don't list object attributes.
Basic Sequence Diagram Symbols and Notations

Page 49Classification: Restricted
Basic Sequence Diagram Symbols and Notations
Activation or Execution Occurrence
Activation boxes represent the time an object needs to complete a task.
When an object is busy executing a process or waiting for a reply message,
use a thin gray rectangle placed vertically on its lifeline.

Page 50Classification: Restricted
Basic Sequence Diagram Symbols and Notations
Messages
Messages are arrows that represent communication between objects. Use
half-arrowed lines to represent asynchronous messages. Asynchronous
messages are sent from an object that will not wait for a response from the
receiver before continuing its tasks..

Page 51Classification: Restricted
Basic Sequence Diagram Symbols and Notations
Lifelines
Lifelines are vertical dashed lines that indicate the object's presence over
time.

Page 52Classification: Restricted
Basic Sequence Diagram Symbols and Notations
Destroying Objects
Objects can be terminated early using an arrow labeled "<< destroy >>" that
points to an X. This object is removed from memory. When that object's
lifeline ends, you can place an X at the end of its lifeline to denote a
destruction occurrence.
Loops
A repetition or loop within a sequence diagram is depicted as a rectangle.
Place the condition for exiting the loop at the bottom left corner in square
brackets [ ].

Page 53Classification: Restricted
Types of Messages in Sequence Diagram
Synchronous Message
A synchronous message requires a response before the interaction can
continue. It's usually drawn using a line with a solid arrowhead pointing
from one object to another.

Page 54Classification: Restricted
Types of Messages in Sequence Diagram
Asynchronous Message
Asynchronous messages don't need a reply for interaction to continue. Like
synchronous messages, they are drawn with an arrow connecting two
lifelines; however, the arrowhead is usually open and there's no return
message depicted.

Page 55Classification: Restricted
Types of Messages in Sequence Diagram

Page 56Classification: Restricted
Types of Messages in Sequence Diagram

Page 57Classification: Restricted
Types of Messages in Sequence Diagram

Page 58Classification: Restricted
Types of Messages in Sequence Diagram

Page 59Classification: Restricted
Caller Phone Recipient
Picks up
Dial tone
Dial
Ring notification Ring
Picks up
Hello
Sequence Diagram (make a phone call)

Page 60Classification: Restricted
Sequence Diagram : Object interaction
Self-Call:Amessagethatan
Objectsendstoitself.
Condition:indicateswhena
messageissent.Themessageis
sentonlyiftheconditionistrue.
Iteration
Condition
A B
Synchronous
Asynchronous
Transmission
delayed
Self-Call
[condition]
remove()
*[for each]
remove()

Page 61Classification: Restricted
Sequence Diagrams –Object Life Spans
•Creation
•Create message
•Object life starts at that point
•Activation
•Symbolized by rectangular stripes
•Place on the lifeline where object is
activated.
•Rectangle also denotes when object
is deactivated.
•Deletion
•Placing an ‘X’ on lifeline
•Object’s life ends at that point
Activation
bar
A
B
Create
X
Deletion
Return
Lifeline

Page 62Classification: Restricted
Sequence Diagrams –Example

Page 63Classification: Restricted
The second interaction diagram is collaboration diagram. It shows the
object organization. Here in collaboration diagram the method call
sequence is indicated by some numbering technique.
Collaboration Diagrams

Page 64Classification: Restricted
Collaboration Diagram : Example

Page 65Classification: Restricted
•Showstherelationshipbetweenobjectsandtheorderofmessagespassed
betweenhem.
•Theobjectsarelistedasrectanglesandarrowsindicatethemessagesbeing
passed
•Thenumbersnexttothemessagesarecalledsequencenumbers.They
showthesequenceofthemessagesastheyarepassedbetweentheobjects.
•Conveythesameinformationassequencediagrams,butfocusonobject
rolesinsteadofthetimesequence.
Interaction Diagrams : Collaboration diagrams

Page 66Classification: Restricted
State Diagrams: (Billing Example)
StateDiagramsshowthesequencesofstatesanobjectgoesthroughduring
itslifecycleinresponsetostimuli,togetherwithitsresponsesandactions;
anabstractionofallpossiblebehaviors.
Unpaid
Start
End
Paid
Invoice created paying Invoice destroying

Page 67Classification: Restricted
State Diagrams: (Traffic light example)
Yellow
Red
Green
Traffic Light
State
Transition
Event
Star
t

Page 68Classification: Restricted
Activity Diagram
Overview
•Activity diagram is another important diagram in UML to describe dynamic
aspects of the system.
•Activity diagram is basically a flow chart to represent the flow form one
activity to another activity. The activity can be described as an operation of
the system.
•So the control flow is drawn from one operation to another. This flow can
be sequential, branched or concurrent. Activity diagrams deals with all type
of flow control by using different elements like fork, join etc.

Page 69Classification: Restricted
Purpose of an Activity Diagram
•Draw the activity flow of a system.
•Describe the sequence from one activity to another.
•Describe the parallel, branched and concurrent flow of the system.

Page 70Classification: Restricted
Elements of Activity Diagram

Page 71Classification: Restricted

Page 72Classification: Restricted

Page 73Classification: Restricted

Page 74Classification: Restricted
Activity Diagram : Example

Page 75Classification: Restricted
Activity Diagram : Example

Page 76Classification: Restricted
•Agile Methodology
•User Story –Introduction
•Format of User Story
•Usage of User Story
•Example of User Story
Topics to be covered in next session

Page 77Classification: Restricted
Thank you