View
267
Download
0
Category
Preview:
Citation preview
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
1/35
Object OrientedObject Oriented
Analysis AndAnalysis And
design Throughdesign ThroughUMLUML
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
2/35
This sessionThis session
Introduction to modelingIntroduction to modeling Class diagramsClass diagrams
Use case diagramsUse case diagrams
Sequence DiagramsSequence Diagrams
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
3/35
Introduction to ModelingIntroduction to Modeling
What is a model?What is a model?
A model is a simplification of realty.A model is a simplification of realty.
Why do we model?Why do we model?
We build models so that we can betterWe build models so that we can better
understand the system we are developingunderstand the system we are developing
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
4/35
How can you realize theHow can you realize the
benefits of modeling?benefits of modeling?
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
5/35
What is the UMLWhat is the UML
The UML is the standard language forThe UML is the standard language for Visualizing,Visualizing,
Specifying,Specifying,
Constructing, andConstructing, and
DocumentingDocumenting
the artifacts of a software-intensive systemthe artifacts of a software-intensive system
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
6/35
RELATIONSHIPS
DIAGRAMS
THINGS
STRUCTURAL
BEHAVIORAL
GROUPING
ANNOTATIONAL
DEPENDENCY
ASSOCIATION
GENARALIZATION
REALIZATION
1. CLASS
2. OBJECT
3. COMPONANT
4. USE CASE
5. SEQUENCE
6. COLLOBORATION
7. ACTIVITY
8. AND OTHERS
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
7/35
All the modeling techniquesAll the modeling techniques
in briefin briefSequence
Diagrams
Collaboration
diagrams
State
MachineDiagrams
Activity
Diagrams
Deployment
Diagrams
ComponentDiagrams
Object
Diagrams
Class
diagrams
Use case
diagrams
UML
MODELS
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
8/35
Classification of UMLClassification of UML
Structural model viewStructural model view
1) class diagrams1) class diagrams
2) object diagrams2) object diagrams
user model viewuser model view
1) use case diagrams1) use case diagrams
Behavioral model viewBehavioral model view
1) sequence diagrams1) sequence diagrams
2) collaboration diagrams2) collaboration diagrams
3) state machine diagrams3) state machine diagrams
4) activity diagrams4) activity diagrams
Implementation model viewImplementation model view
1)component diagrams1)component diagrams
Environment model viewEnvironment model view
1) deployment diagrams1) deployment diagrams
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
9/35
Structural modelStructural model
viewviewClass DiagramsClass Diagrams
Object DiagramsObject Diagrams
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
10/35
DEPENDENCY GENARALIZATIO
REALIZATION ASSOCIATION
Class diagram
Structure &behavior
Relationships Multiplicity &Navigation
ne Class uses the
formation of otherOne class specifiesA contract that other
Class will carru out
Objects of one thing areConnected to objects
Of another
Relationship betweenGeneral kind of class
And a more specificKind of class
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
11/35
Structure of a ClassStructure of a Class
A class is a collection ofA class is a collection ofobjects with commonobjects with commonstructure, common behavior,structure, common behavior,common relationships andcommon relationships and
common semanticscommon semantics
Classes should be namedClasses should be namedusing the vocabulary of theusing the vocabulary of thedomaindomain Naming standards should beNaming standards should be
createdcreated e.g., all classes aree.g., all classes are singularsingular
nounsnouns starting with a capitalstarting with a capitalletterletter
ClassNameClassName
AttributesAttributes
OperationsOperations
ResponsibilitiResponsibilitieses
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
12/35
Operations andOperations and
AttributesAttributes
OperationsOperations ::The behavior of a class is represented by itsThe behavior of a class is represented by itsoperationsoperations
AttributesAttributes ::The structure of a class is represented by itsThe structure of a class is represented by itsattributesattributes
ResponsibilitiesResponsibilities:: It is a contract or an obligation of a classIt is a contract or an obligation of a class..
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
13/35
Advanced RelationshipsAdvanced Relationships
AggregationAggregation:: It is a special kind of association and is used when oneIt is a special kind of association and is used when oneclass (whole) consists of 1 or more smaller classes (parts). It shows has-aclass (whole) consists of 1 or more smaller classes (parts). It shows has-arelationship between the whole and its parts.relationship between the whole and its parts.
CompositionComposition ::This specifies that the lifetime of theThis specifies that the lifetime of thepart classifier is dependent on the lifetime of the wholepart classifier is dependent on the lifetime of the whole
classifierclassifier
InheritanceInheritance ::There are two ways to findThere are two ways to findinheritance:inheritance: GeneralizationGeneralization:: As you move "up" the hierarchy, you achieveAs you move "up" the hierarchy, you achieve
greater generalization . You move up toward Mammal to generalize thatgreater generalization . You move up toward Mammal to generalize thatdogs, cats, and horses all bear live youngdogs, cats, and horses all bear live young.. SpecializationSpecialization:: As you move "down" the hierarchy youAs you move "down" the hierarchy you
specialize. Thus, the cat specializes Mammal in having claws (aspecialize. Thus, the cat specializes Mammal in having claws (acharacteristic) and purring (a behaviorcharacteristic) and purring (a behavior
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
14/35
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
15/35
Multiplicity and NavigationMultiplicity and Navigation
MultiplicityMultiplicity defines how manydefines how manyobjects participate in a relationshipobjects participate in a relationship Multiplicity is the number ofMultiplicity is the number of
instances of one class related toinstances of one class related toONE instance of the other classONE instance of the other class
For each association andFor each association andaggregation, there are twoaggregation, there are two
multiplicity decisions to make:multiplicity decisions to make:one for each end of theone for each end of therelationshiprelationship
IfIfnavigationnavigation is restricted, anis restricted, anarrowhead is added to indicate thearrowhead is added to indicate thedirection of the navigationdirection of the navigation
IndicatoIndicatorr
MeaningMeaning
0..10..1 Zero or oneZero or one
11
One onlyOne only
0..*0..* Zero or moreZero or more
1..*1..* One or moreOne or more
nn OnlyOnly nn ((nn > 1)> 1)
0..n0..n Zero toZero to nn ((nn> 1)> 1)
1..n1..n One toOne to nn ((nn > 1)> 1)
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
16/35
A small Work outA small Work out
Try to make Class diagram for aTry to make Class diagram for abanking system ?????????banking system ?????????
NOWNOW
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
17/35
Building a systemBuilding a system
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
18/35
user model viewuser model view
Use case DiagramsUse case Diagrams
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
19/35
RelationshipsBetween Actors
& usecases
Use CaseDiagrams
Behavior orUSE CASEActor
What's up inWhat's up in
usecases??????usecases??????
An actor is aAn actor is aperson,person,
organization,organization,
or externalor external
system thatsystem that
plays a role inplays a role in
one or moreone or more
interactionsinteractionswith yourwith your
I t d ti t USE CASEI t d ti t USE CASE
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
20/35
Introduction to USE CASEIntroduction to USE CASE
diagramsdiagrams
What is a use case diagram??What is a use case diagram??AA use case diagramuse case diagram is a type ofis a type ofbehavioral diagrambehavioral diagram. whose purpose is to. whose purpose is to
present a graphical overview of the functionality provided by a system in termspresent a graphical overview of the functionality provided by a system in termsof actors, their goals (represented as use cases), and any dependenciesof actors, their goals (represented as use cases), and any dependencies
between those use casesbetween those use cases
What do they represent?What do they represent?
They represent the functionality of the system from users point of viewThey represent the functionality of the system from users point of view
who will be using the system?who will be using the system?
ACTORACTOR
what will they be using it to do? ?what will they be using it to do? ?
USECASEUSECASE
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
21/35
Who is an actor???Who is an actor???
For example, a bank cardholder might need to use an ATM to getFor example, a bank cardholder might need to use an ATM to getcash out of their account. It is as simple as that.cash out of their account. It is as simple as that. Actors don't have to be people. They can be other systems. ForActors don't have to be people. They can be other systems. For
example, the ATM may need to connect to the cardholder's bank.example, the ATM may need to connect to the cardholder's bank.External systems that interact in a use case are also actors.External systems that interact in a use case are also actors.
actor system goal
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
22/35
What Is A Use Case Scenario?What Is A Use Case Scenario?
Some examples ofSome examples ofuse case scenariosuse case scenarios.. When a cardholder tries to withdraw cash from an ATM, itWhen a cardholder tries to withdraw cash from an ATM, it
doesn't always necessarily turn out the same way.doesn't always necessarily turn out the same way. Sometimes he gets his money.Sometimes he gets his money. Other times he might have insufficient funds.Other times he might have insufficient funds.
Or the ATM may be out of cashOr the ATM may be out of cash
The outcome is different, depending on circumstances, but theyThe outcome is different, depending on circumstances, but theyall relate to the same functional goal . that is, they're all triggeredall relate to the same functional goal . that is, they're all triggeredby the same need and all have the same starting point.by the same need and all have the same starting point.
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
23/35
Capturing Use Case Scenarios withCapturing Use Case Scenarios with
Essential Use Case DescriptionsEssential Use Case Descriptions Dont go into technical aspect ofDont go into technical aspect of
the designthe design We first need toWe first need to understand what theunderstand what the
business logicbusiness logic of the interactions are,of the interactions are,so we can focus on satisfying theso we can focus on satisfying thebusiness goal of the use case.business goal of the use case.
Instead of saying the user presses theInstead of saying the user presses theenter button, we say the userenter button, we say the userconfirms their choice, for example.confirms their choice, for example.
split the actions into columns, onesplit the actions into columns, onefor each actor and one for thefor each actor and one for thesystem. Then we can see at asystem. Then we can see at aglance not only the order of eventsglance not only the order of eventsin a use case scenario, but alsoin a use case scenario, but alsoexactly who is doing what.exactly who is doing what.
AnAn essential use caseessential use case clearly showsclearly showsthethe order of eventsorder of events and theand theresponsibilities of the actor(sresponsibilities of the actor(s) and) andsystemsystem in a single use case scenario,in a single use case scenario,without committing to technicalwithout committing to technicaldesigndesign decisionsdecisions
select withdrawal optiondisplay withdrawaldisplay withdrawaloptionsoptions
specify amountspecify amountcheck card holdercheck card holder
hashasSufficient fundsSufficient funds
eject cardeject card
prompt cardholder to takeprompt cardholder to take
cardcard
take cardtake carddispense amountdispense amount
prompt cardholder to takeprompt cardholder to takecashcashtake cashtake cashdebit cardholdersdebit cardholders
accountaccountthank cardholderthank cardholder
display welcome and awaidisplay welcome and awainext holdernext holder
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
24/35
Usecase1
Usecase2
actor
Depiction of actor and usecase
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
25/35
Remember that use case designs aren'tRemember that use case designs aren't
the same thing as requirements. Thesethe same thing as requirements. These
are high-level interaction designs. ifare high-level interaction designs. if
we mix them up with real requirementswe mix them up with real requirements
stuff the system really has to do ,thenstuff the system really has to do ,then
we can get bogged down in the designwe can get bogged down in the design
decisions we make early on.decisions we make early on.
WARNINGWARNING
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
26/35
Documenting Use CasesDocumenting Use Cases
A flow of events document is created for eachA flow of events document is created for eachuse cases Written from an actor point of viewuse cases Written from an actor point of view
Details what the system must provide to theDetails what the system must provide to theactor when the use cases is executedactor when the use cases is executed
Typical contentsTypical contents How the use case starts and endsHow the use case starts and ends
Normal flow of eventsNormal flow of events
Alternate flow of eventsAlternate flow of events
Exceptional flow of eventsExceptional flow of events
e at ons ps etween
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
27/35
e at ons ps etweenUse Cases
Including Use Cases: Whentwo or more use casesinclude the flow of anotheruse case, they are said toinclude that use case's flow.
Extending Use Cases: relationship
means that the flow of theextending use case is onlyincluded under specificconditions
Check tutor availa
Book assesment
Book lesson
View Product
Review Product
Check Login
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
28/35
Summary of use casesSummary of use cases
1. Identify your actors: who will be using the system?2. Identify their goals: what will they be using the system to do?
3. Identify key scenarios: in trying to achieve a specific goal, whatdistinct outcomes or workflows might we need to consider?
4. Describe in business terms the interactions between the actor(s)and the system for a specific scenario
5. Create a UI prototype that clearly communicates the scenario totechnical and
6. non-technical stakeholders
7. Do a high-level OO design for the scenario8. Implement the design in code9. Get feedback from your users . ideally through structured
acceptance testing10. Move on to the next scenario or use case (.rinse and repeat.)
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
29/35
A small Work outA small Work out
Try to make Use case diagram for aTry to make Use case diagram for abanking system ?????????banking system ?????????
NOWNOW
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
30/35
Behavioral ModelBehavioral Model
ViewView1.1. Sequence DiagramsSequence Diagrams
2.2. Collaboration DiagramsCollaboration Diagrams
3.3. State Machine DiagramsState Machine Diagrams4.4. Activity DiagramsActivity Diagrams
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
31/35
Sequence DiagramsSequence Diagrams
The sequence diagram is used primarily toThe sequence diagram is used primarily to
show the interactions between objects in theshow the interactions between objects in the
sequential order that those interactions occur.sequential order that those interactions occur.
useful to communicate how the businessuseful to communicate how the businesscurrently works by showing how variouscurrently works by showing how various
business objects interact.business objects interact.
business-level sequence diagram can be usedbusiness-level sequence diagram can be used
as a requirements document to communicateas a requirements document to communicaterequirements for a future systemrequirements for a future system
implementation.implementation.
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
32/35
Notation BasicsNotation Basics
Lifelines:Lifelines: Lifelines are drawn as a box with a dashed line descending from theLifelines are drawn as a box with a dashed line descending from thecenter of the bottom edge .The lifeline's name is placed inside the box.center of the bottom edge .The lifeline's name is placed inside the box.
Messages:Messages: The first message of a sequence diagram always starts at the topThe first message of a sequence diagram always starts at the topand is typically located on the left side of the diagram for readability. Subsequentand is typically located on the left side of the diagram for readability. Subsequent
messages are then added to the diagram slightly lower then the previous message.messages are then added to the diagram slightly lower then the previous message.
Guards:Guards: Guards are used throughout UML diagrams to control flow.Guards are used throughout UML diagrams to control flow.WhenWhenmodeling object interactions, there will be times when a condition must be met for amodeling object interactions, there will be times when a condition must be met for a
message to be sent to the object.message to be sent to the object.
Alternatives :Alternatives : Alternatives are used to designate a mutually exclusiveAlternatives are used to designate a mutually exclusivechoice between two or more message sequences. Alternatives allow the modeling ofchoice between two or more message sequences. Alternatives allow the modeling of
the classic "if then else" logicthe classic "if then else" logic
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
33/35
Life lines
Messages
Guards
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
34/35
Alternative
8/14/2019 Visual Modeling Unified Modeling Language( Uml)
35/35
A small Work outA small Work out
Try to make Sequence diagram for aTry to make Sequence diagram for abanking system ?????????banking system ?????????
NOWNOW
Recommended