UML Overview

O.Widder.(2013).geek&poke.Available:http://geek-and-poke.com
UML
UnifiedModelingLanguage
Hans-PetterHalvorsen,M.Sc.
UnifiedModelingLanguage(UML)
Examples
Class Diagram
UseCaseDiagram
2
Deployment
Planning
Maintenance
Testing
Implementation
TheSoftware
Development
Lifecycle
(SDLC)
Design
Requirements
Analysis
DocumentsinSoftwareDevelopment
ProjectStart
1.Planning
Time
(stakeholders,the
softwareteam;
architects,UX
designers,
developers)
2.Testing
(QApeople)
3.End-user
Documentation
(Thepeoplethat
shallactuallyuse
thesoftware)
ProjectFinish
4.Handover
(Business people)
High-Level
Requirementsand
DesignDocuments
WHAT
Detailed
Requirementsand
DesignDocuments
ERDiagram
UMLDiagrams
CADDrawings
TestPlans
TestDocumentation
HOW
HowtoTest/
WhattoTest
Proofthatyouhavetested
andthatthesoftwareworks
asexpected
System
Documentation
TechnicalStuff
InstallationGuides
Howtoinstallit
UserManuals
FinalReport
(SuperUser/ITdep.)
Howtouseit
(EndUser)
UnifiedModelingLanguage(UML)
• Amodelinglanguageusedinsoftware
engineering
• VerypopularwithinOOA,OOD,OOP
• Developedinthe1990s
• UMLwasadaptedasanISOstandardin2000
• UML2.2has14differenttypesofdiagrams
OOA=ObjectOrientedAnalysis,OOD=ObjectOrientedDesign,OOP=ObjectOrientedProgramming
UMLDiagrams
6
UMLDiagrams
•
•
•
•
•
•
•
•
•
•
•
•
•
Klassediagram (ClassDiagram)
Komponentdiagram (ComponentDiagram)
Produksjonssettingsdiagram (DeploymentDiagram)
Objektdiagram (ObjectDiagram)
Pakkediagram (PackageDiagram)
Aktivitetsdiagram (ActivityDiagram)
Sekvensdiagram (SequenceDiagram)
Samhandlingsdiagram (CommunicationDiagram),forenklet versjon av
UML1.xCollaborationDiagram
Bruksmønserdiagram (UseCaseDiagram)
Tilstandsdiagram (StateMachineDiagram)
Sammensatt strukturdiagram (CompositeStructureDiagram)(UML2.0)
Interaksjonsoversiktsdiagram (InteractionOverviewDiagram)(UML2.0)
Tidsforløpsdiagram (TimingDiagram)(UML2.0)
7
UMLDiagrams
2categories:
1. StructureDiagrams
–…
2. BehaviorDiagrams
–…
– InteractionDiagrams(ASubsetofBehaviorDiagrams)
–…
8
UseCase
UseCaseExampleforaRestaurant:
Ausecaseisalistofsteps,
typicallydefininginteractions
betweenarole(knowninUMLas
an"actor")andasystem,to
achieveagoal.
Theactorcanbeahumanoran
externalsystem.
[http://en.wikipedia.org/wiki/Use_case]
9
UseCaseExample
Ause-casediagramforacourseregistrationsystem
10
UseCaseExample
11
SequenceDiagram
12
ClassDiagram
13
ClassInheritance
Whenaclassinheritsfromanotherclass,itautomaticallygetsallitsattributesandmethods.
IfclassAinheritsfromclassB,wecallclassAthesuperclassandclassBthesubclass.
Inheritancerelationshipisan“is-a”relationshipbetweenthesubclassandthesuperclass.
Althoughthesubclasscanoverrideanymethoditinheritsfromthesuperclass,changingits
behavior,theintentistomostlyaddadditionalmethods.
14
WhyuseUML?
• Design
– ForwardDesign:doingUMLbeforecoding.Makesit
easiertocreatethecodeinastrucuredmanner
– BackwardDesign:doingUMLaftercodingas
documentation
– WhendoingchangesintheDesign,makesureto
updatetheCodeaccordingtothenewDesign
• Code
– SomeToolscanAutogenerateCodefromUML
diagrams
– WhendoingchangesintheCode,makesureto
updatetheUMLDiagrams
15
UseCaseandScrum(Agile)
• TheTeamworkscloesly togetherwiththe
ProductOwner
• Lessneedfordetaileddescriptionsand
requirements
• Agile/ScrumusesUserStoriesinstead(which
couldbeconsideredasalightversionofUse
Case)
• TheUserStoriesarethebasefortheProduct
BacklogandtheSprintBacklog
16
UMLSoftware
•
•
•
•
•
•
MSVisio
EnterpriseArchitect
StarUML
RationalRose
VisualStudioEnterprise
etc.(hundredsdifferentalternatives)
17
UMLinVisualStudioEnterprise
http://channel9.msdn.com/Series/Visual-Studio-2012-Premium-and-Ultimate-Overview/Visual-Studio-Ultimate2012-Improving-architecture-through-modeling
18
UMLExercise- Solutions
Aktør
UseCase
19
UMLExercise- Solutions
+“Kjøp Ringetid”
Etuse case(bruksmønsterdiagram)erenbeskrivelseavhvordansystemetoppnår
etmålavverdiforenaktør.
Bruksmønsterdiagrammer(Use Casediagrams)brukestilåbeskriveinteraksjonen
mellombrukereogsystemer.Bruksmønstrebeskriverinteraksjonenmellomet
systemogeksterneaktører.
Summary
• ItisimportanttocreateDesignandSpecifications
(includingUML)before youstartCoding
• ButUMLcanalsobeusedtodocumentyourcode
afterwards
• UMLdiagramsisageneralmethod/standardtodo
justthat
• Thismakesiteasiertocreatestructuredcode
• Agoodwaytodocumentyourcodeproperly.
• Coderefactoring:UseUMLaspartofthe
continuouscodeimprovementsprocess
21
References
•
•
•
•
•
•
Wikipedia.(2013).UnifiedModelingLanguage.Available:
http://en.wikipedia.org/wiki/Unified_Modeling_Language
I.Sommerville,SoftwareEngineering:Pearson,2010.
Wikipedia.(2013).ScrumDevelopment.Available:
http://en.wikipedia.org/wiki/Scrum_(development)
S.Adams.Dilbert.Available:http://dilbert.com
O.Widder.(2013).geek&poke.Available:http://geek-and-poke.com
B.Lund.(2013).Lunch.Available:http://www.lunchstriper.no,
http://www.dagbladet.no/tegneserie/lunch/
22
Hans-PetterHalvorsen,M.Sc.
UniversityCollegeofSoutheastNorway
www.usn.no
E-mail:[email protected]
Blog:http://home.hit.no/~hansha/