Download - Language Modeling Unified
![Page 1: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/1.jpg)
UnifiedUnifiedModelingModeling
LanguageLanguage
Luciano BaresiLuciano Baresi
![Page 2: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/2.jpg)
Computer SystemComputer System
“A model captures all“A model captures allessential details of a systemessential details of a system””
Dr. James James RumbaughRumbaugh
Visual ModelingVisual Modeling
Business ProcessBusiness Process
requestrequest
orderorder
deliverydelivery
![Page 3: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/3.jpg)
ContributionsContributionsHarelHarel
StatechartsStatechartsMeyerMeyer
Before and after Before and after conditionsconditions
Gamma, et alGamma, et al
Frameworks and patterns,Frameworks and patterns,
HP FusionHP Fusion
Operation descriptions and Operation descriptions and message numberingmessage numbering
EmbleyEmbley
Singleton classes andSingleton classes andhighhigh--level viewlevel view
WirfsWirfs--BrockBrock
ResponsibilitiesResponsibilities
OdellOdell
ClassificationClassification
Shlaer Shlaer -- MellorMellor
Object lifecyclesObject lifecycles
RumbaughRumbaugh
OMTOMT
BoochBooch
Booch methodBooch method
JacobsonJacobson
OOSEOOSE
![Page 4: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/4.jpg)
UML DiagramsUML Diagrams
�� Static viewsStatic viewshhUse case diagramUse case diagramhhClass diagramClass diagramhhObject diagramObject diagramhhComponent diagramComponent diagramhhDeployment diagramDeployment diagram
�� Dynamic viewsDynamic viewshhSequence diagramSequence diagramhhCollaboration diagramCollaboration diagramhhStatechart diagramStatechart diagramhhActivity diagramActivity diagram
![Page 5: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/5.jpg)
Use Case Diagrams Use Case Diagrams
![Page 6: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/6.jpg)
Modeling ElementsModeling Elements
�� Actor: it is a user (human being) or Actor: it is a user (human being) or external system that:external system that:hhExchanges data with the systemExchanges data with the system
�� Provides inputs to and/or receives outputs Provides inputs to and/or receives outputs from the systemfrom the system
�� Use case: it is a functional entity the Use case: it is a functional entity the system is composed of:system is composed of:hh It identifies a feature that the system will It identifies a feature that the system will
provideprovide
![Page 7: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/7.jpg)
Foundamental RelationshipsFoundamental Relationships
�� Interacts Interacts means that there is a link means that there is a link between the actor and use casebetween the actor and use case
�� UsesUses identifies the use of a given identifies the use of a given functionality (it is usefull to stress functionality (it is usefull to stress similiar features in different contexts)similiar features in different contexts)
�� ExtendsExtends defines a case as extension defines a case as extension with respect to a base one (it is the with respect to a base one (it is the way these diagrams use inheritance)way these diagrams use inheritance)
<uses>
![Page 8: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/8.jpg)
User
Manager ATM Machine
Desk
ContextContext
�� The first use case diagram The first use case diagram defines the context of the defines the context of the systemsystem
�� Different choices imply Different choices imply hhDifferent actorsDifferent actorshhDifferent casesDifferent cases
![Page 9: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/9.jpg)
Change Course
Request for Students
Professor
Select Course
Manage Professors
Manage Students
Repository
Manage Courses
Request for courses
Change chosen courses
Student
Register for a courseAccounting Office
... A Simple University... A Simple University
![Page 10: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/10.jpg)
Customer
Manager
Credit definition
Order Order through the Internet
extends
Customer Info
uses
Product Availability
uses
Payment Terms
uses
uses
Another ExampleAnother Example
![Page 11: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/11.jpg)
User ScenariosUser Scenarios
�� A scenario is an instance of a use caseA scenario is an instance of a use casehh It is a specific execution of the use caseIt is a specific execution of the use casehh It defines events and actions for the specific “execution”It defines events and actions for the specific “execution”
�� Scenarios define lowerScenarios define lower--level requirements than use case level requirements than use case diagramsdiagrams
�� Scenarios are usually defined using natural languageScenarios are usually defined using natural language�� UML proposes a more specialized notationUML proposes a more specialized notation
Interaction diagramsInteraction diagrams
![Page 12: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/12.jpg)
Interaction DiagramsInteraction Diagrams
![Page 13: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/13.jpg)
Interaction DiagramsInteraction Diagrams
�� Define the dynamic behavior of a set of objects that Define the dynamic behavior of a set of objects that cooperate for a common goalcooperate for a common goal
�� Are used to “formalize” scenarios in terms ofAre used to “formalize” scenarios in terms ofhhEntities (objects)Entities (objects)hhMessages (methods)Messages (methods)
�� UML offers two different kinds of interaction UML offers two different kinds of interaction diagrams diagrams hhSequence diagramsSequence diagramshhCollaboration diagramsCollaboration diagrams
![Page 14: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/14.jpg)
Goofy Selector
Choose Comp. Science
Available?
Add Goofy
Acknowledge registration
Sequence DiagramsSequence Diagrams
Comp. Science
![Page 15: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/15.jpg)
Sequence DiagramsSequence DiagramsCaller User Means Called User
StartTone
Dial
...
Route
Wait Ring
Answer
Ready Ready
ab
c
d
d’
{b{b--a < 1 sec.}a < 1 sec.}{c{c--b < 10 sec.}b < 10 sec.}
{d’{d’--d < 5 sec.}d < 5 sec.}
The delay comes The delay comes from the networkfrom the network
Now they can start Now they can start chattingchatting
![Page 16: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/16.jpg)
Collaboration DiagramsCollaboration Diagrams
�� Are very close to sequence diagramsAre very close to sequence diagrams�� Highlight the interactions among parts of the same Highlight the interactions among parts of the same
object, instead of among different objectsobject, instead of among different objectshhThey better model messagesThey better model messages
�� Sequences must be modeled explicitely. They do not Sequences must be modeled explicitely. They do not come from reading the diagram in the “usual” waycome from reading the diagram in the “usual” wayhhMessages must be numbered using a dotMessages must be numbered using a dot--like notationlike notation
![Page 17: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/17.jpg)
Collaboration DiagramsCollaboration Diagrams
:Selector1: Before
true
2: Before
Software Eng.
Comp. Science: Course
![Page 18: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/18.jpg)
Another ExampleAnother Example
:Selector
info:AccountingInfo
folder:StudentFolder
Goofy
1: Select 4 courses
2: Select Comp. Science3: Select Soft. Eng.4: Select Physics
5: Select Web Design
6: Select 2 more courses
7: Select Chemistry8: Select History
9: Submit courses
10: Available11: Add Goofy
12: Create Folder
13: Create Accounting Info
Course:Course
![Page 19: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/19.jpg)
Class DiagramsClass Diagrams
![Page 20: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/20.jpg)
Class DiagramsClass Diagrams
�� Define THE static view of a system in terms ofDefine THE static view of a system in terms ofhhClassesClasseshhRelationships among classes:Relationships among classes:
�� Associations (uses)Associations (uses)�� Generalizations (inheritance)Generalizations (inheritance)�� Aggregations (part of)Aggregations (part of)
�� Are the basic elements of all object systemsAre the basic elements of all object systems
![Page 21: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/21.jpg)
ClassesClasses(Visibility)(Visibility)
ProfessorProfessor
+ name: String# surname: String - age: integer = 33
+ visualize()- setCourse()
Professor
name: Stringsurname: Stringage: integer
visualize()setCourse()
Professor
![Page 22: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/22.jpg)
namenamesurnamesurname
ProfessorProfessor
ageage
idid namenamesurnamesurname
ProfessorProfessor
ageage
WellWell--formed Classesformed Classes
�� All object have their own identity. We do not need to All object have their own identity. We do not need to add it to all classes we designadd it to all classes we design
![Page 23: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/23.jpg)
Derived AttributesDerived AttributesPersonPerson
dateOfBirthdateOfBirth: Date: Date/ age :age : intint
DepartmentDepartment
1..*1..*
PersonPerson1..*1..*
worksworks
1..*1..*
/ / employsemploys{age = today {age = today -- dateOfBirthdateOfBirth}}
CompanyCompany
![Page 24: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/24.jpg)
AssociationsAssociations
�� Define bidirectional information channels among Define bidirectional information channels among classesclasses
�� Multiplicity defines the number of instances that are Multiplicity defines the number of instances that are involved in a given associationinvolved in a given association
�� Links are association instancesLinks are association instanceshhA link connects two objectsA link connects two objectshhAn association connects two classesAn association connects two classes
![Page 25: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/25.jpg)
CourseCourse StudentFolderStudentFolderappearsappears
AssociationsAssociations
�� Indicate relationships among classesIndicate relationships among classeshhAn employ that works in a companyAn employ that works in a company
�� Can be labelledCan be labelledhhThe label is usually a verbThe label is usually a verb
![Page 26: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/26.jpg)
CourseCourse StudentStudent3 .. 103 .. 100..*0..*
MultiplicityMultiplicity
�� States how many objects are involved in an States how many objects are involved in an associationassociationhhThe minimum and maximum number of involed objectsThe minimum and maximum number of involed objects
�� States whether the association is mandatoryStates whether the association is mandatory
takestakes
![Page 27: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/27.jpg)
MultiplicityMultiplicity
11Exactly 1Exactly 1
** Zero or moreZero or more
0..10..1 Zero or oneZero or one
m..nm..n From m to nFrom m to n
![Page 28: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/28.jpg)
CourseCourse CurriculumCurriculum1..*1..*
AggregationsAggregations
�� Aggregations are specialAggregations are special--purpose associations. They purpose associations. They must be used when an object must be used when an object containscontains other objects other objects ((partpart--ofof))
![Page 29: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/29.jpg)
SliderSliderPanelPanel ButtonButton
WindowWindow
1
2
1
1
1
1scrollbarscrollbar
bodybody closeclose22
11 11
11
11
11
CompositionsCompositions
�� Compositions are stronger aggreations Compositions are stronger aggreations hhParts cannot live alone; They depend on their containerParts cannot live alone; They depend on their container
![Page 30: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/30.jpg)
containscontains
CourseCourse
precedesprecedes
PartPart
Reflexive AssociationsReflexive Associations
�� Un’associazione è riflessiva se coinvolge oggetti della Un’associazione è riflessiva se coinvolge oggetti della stessa classestessa classe
�� Indicano oggetti multipli della stessa classe che sono Indicano oggetti multipli della stessa classe che sono in relazione fra loroin relazione fra loro
![Page 31: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/31.jpg)
PersonPerson
StudentStudent ProfessorProfessor
Inheritance (Generalization)Inheritance (Generalization)
�� Makes explicit common Makes explicit common behaviorsbehaviors
�� Could require:Could require:hhThe addiction of new The addiction of new
propertiespropertieshhThe modification of The modification of
existing operationsexisting operations
![Page 32: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/32.jpg)
Abstract ClassesAbstract Classes
PolygonPolygon CircleCircle
ShapeShape
TriangleTriangle SquareSquare
![Page 33: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/33.jpg)
Statechart DiagramsStatechart Diagrams
![Page 34: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/34.jpg)
Statechart DiagramsStatechart Diagrams
�� Define the interal behavior of single objects (classes) Define the interal behavior of single objects (classes) in terms ofin terms ofhhEvents to which objects are sensible toEvents to which objects are sensible tohhProduced actionsProduced actionshhState transitionsState transitions
�� They are used to identify internal statesThey are used to identify internal states
�� Describe parallel and concurrent activitiesDescribe parallel and concurrent activities�� Come from statecharts by D. HarelCome from statecharts by D. Harel
![Page 35: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/35.jpg)
StateChartsStateCharts
StateState OR DecompositionOR Decomposition
AND DecompositionAND Decomposition
eventeventactionaction
TransitionTransition
![Page 36: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/36.jpg)
A Simple InteractionA Simple Interaction
EmptyEmpty
TankTank
ClosedClosed
ONONOpenOpen
Fornello
fillfill
FullFull
[gas = 0][gas = 0]
[gas > 0][gas > 0]
openopen
[tank.state == full][tank.state == full]
closeclose
sparkspark
![Page 37: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/37.jpg)
Neutral Reverse
Forward
Low Mid High
R
N
F N
Pick up Pick up
Slow downSlow down
stop
Automatic transmission
Or DecompositionOr Decomposition
�� A macro state means an or decomposition among statesA macro state means an or decomposition among states�� All subAll sub--states inherit the transitions to/from their superstates inherit the transitions to/from their super--statesstates
![Page 38: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/38.jpg)
And DecompositionAnd Decomposition
Naturallyattentive
do: take notes
do: yawn
do: scratch
Inattentive
boredwarning
Forcedlyattentivedo: drawwarning
![Page 39: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/39.jpg)
Activity DiagramsActivity Diagrams
![Page 40: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/40.jpg)
StartStart
Synchronization barSynchronization bar
EndEnd
*ActivityActivity
DecisionDecision
Iterated eventIterated event
success labellabel
Syntactical ElementsSyntactical Elements
![Page 41: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/41.jpg)
An exampleAn exampleReceiveOrder
CheckPayment
CheckAvailability
DeleteOrder
Assign toOrder
ReorderElements
CompleteOrder
* For all elements
failure
success
All pieces available
![Page 42: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/42.jpg)
Other DiagramsOther Diagrams
�� UML offers several other diagramsUML offers several other diagrams�� They are implementationThey are implementation--oriented diagramsoriented diagrams�� They are necessary fromThey are necessary from
hhA complete view of UMLA complete view of UMLhhA complete software processA complete software process
�� They are not covered in this course becauseThey are not covered in this course becausehhWe cover mainly requirementsWe cover mainly requirementshhWe do not exemplify the whole software processWe do not exemplify the whole software process
![Page 43: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/43.jpg)
ReferencesReferences
�� The unified modeling The unified modeling language user guidelanguage user guideG. Booch, J. Rumbaugh e I. G. Booch, J. Rumbaugh e I. JacobsonJacobsonaddison wesley, 1998addison wesley, 1998
�� The modeling language The modeling language reference manualreference manualJ. Rumbaugh, I. Jacobson e J. Rumbaugh, I. Jacobson e G. Booch G. Booch addison wesley, 1999addison wesley, 1999
�� The unified software The unified software development processdevelopment processI. Jacobson, G. Booch e J. I. Jacobson, G. Booch e J. RumbaughRumbaugh
�� UML distilledUML distilledM. Fowler e K. ScottM. Fowler e K. Scottaddison wesley, 1999addison wesley, 1999
�� Http://www.Rational.ComHttp://www.Rational.Com�� Http://www.Omg.OrgHttp://www.Omg.Org
![Page 44: Language Modeling Unified](https://reader036.vdocument.in/reader036/viewer/2022071600/613d3045736caf36b75a5ded/html5/thumbnails/44.jpg)
Any Questions? Any Questions?
Luciano BaresiLuciano BaresiDEI DEI -- Politecnico di MilanoPolitecnico di Milano
Piazza L.Piazza L. dada Vinci, 32 Vinci, 32 -- 20133 Milano (Italia)20133 Milano (Italia)teltel: 0223993638 : 0223993638 -- email:email: baresibaresi@@eletelet..polimipolimi.it.it