Unit-II(STATIC UML DIAGRAMS).ppt

86 views 59 slides Dec 12, 2022
Slide 1
Slide 1 of 59
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

About This Presentation

Static UML diagrams


Slide Content

Unit II-STATIC UML DIAGRAMS

Unified Modeling Language
•UMLisastandardlanguageforspecifying,
visualizing,constructing,anddocumentingthe
artifactsofsoftwaresystems.
•UMLwascreatedbyObjectManagementGroup
andUML1.0specificationdraftwasproposed
totheOMGinJanuary1997.
•Thistutorialgivesacompleteunderstandingon
UML.

Unified Modeling Language (Contd.)
•Amodelissimplifiedbecauserealityistoocomplexor
largeandmuchofthecomplexityactuallyisirrelevant
totheproblemwearetryingtodescribeorsolve
•AModelprovidesameansforconceptualizationand
communicationofideasinapreciseandunambiguous
form.
•Thecharacteristicsofsimplificationandrepresentation
aredifficulttoachieveintherealworld
•Mostmodelingtechniqueusedduringmanyofthe
phasesoftheSLC(servicelifecycle)suchasanalysis,
designandimplementation

Unified Modeling Language (Contd.)
•For example, objectory is build around several different models:
–Use-case model
defines the outside(actor) and inside (use-case) of the system’s
behavior
–Domain object model
Objects of real world are mapped into the domain object model
–Analysis object model
The analysis object model presents how the source code should
be carried out and written
–Implementation Model
The implementation model represents the implementation of the
system
–Test model
The test model constitutes the test plans, specifications, and
reports

Static and Dynamic Models
•Modelscanrepresentstaticanddynamic
•Eachrepresentationhasdifferentimplicationsforhowthe
knowledgeaboutthemodelmightbeorganizedandrepresented
•StaticModel
–Astaticmodelcanbeviewedasasnapshotofasystem’sparametersat
restoraspecificpointintime.
–Staticmodelsareneededtorepresentthestructuralstaticaspectofa
system
–Forexampleacustomercouldhavemorethanoneaccountoranorder
couldbeaggregatedfromoneormorelineitems.
–Staticmodelsassumestabilityandanabsenceofchangeindataovertime
.
–Theunifiedmodelinglanguageclassdiagramisanexampleofastatic
model

Static and Dynamic Models (Contd.)
•Dynamicmodel
–Incontrasttoastaticmodel,canbeviewedasa
collectionofproceduresorbehaviorsthat,taken
together,reflectthebehaviorofasystemovertime.
–Dynamicrelationshipsshowhowthebusiness
objectsinteractstoperformtasks.
–Forexample,anorderinteractswithinventoryto
determineproductavailability.
–TheUMLinteractiondiagramandactivitymodels
areexamplesofUMLdynamicmodels

Why Modeling?
•Buildingamodelforasoftwaresystempriortoits
constructionisasessentialashavingablueprint
forbuildingalargebuilding.
•Goodmodelsareessentialforcommunication
amongprojectteams.
•Amodelinglanguagemustinclude
–Modelelements–fundamentalmodelingconcepts
andsemantics
–Notation–visualrenderingofmodelelements
–Guidelines–expressionofusagewithinthetrade

Modeling (Contd.)
•Theuseofvisualnotationtorepresentormodelaproblem
canprovideusseveralbenefitsrelatingto
–Clarity:wearemuchbetteratpickingouterrorsandomissions
fromagraphicalorvisualrepresentationthanfromlistingof
codeortablesofnumbers.
–Familiarity:Therepresentationformforthemodelmayturn
outtobesimilartothewayinwhichtheinformationactuallyis
representedandusedbytheemployeecurrentlyworkinginthe
problemdomain.
–Maintenance:visualnotationcanimprovethemaintainability
ofasystem.
–Simplification:Useofahigherlevelrepresentationgenerally
resultsintheuseoffewerbutmoregeneralconstructs,
contributingtosimplicityandconceptualunderstanding

Advantages of Modeling
•Modelsmakeiteasiertoexpresscomplex
ideas
•Reductionofcomplexity
•Enhanceandreinforcelearningandtraining
•Costislow
•Manipulationismucheasier

Key Ideas of Modeling
•Amodelisrarelycorrectonthefirsttry
•Alwaysseektheadviceandcriticismofothers.
Youcanimproveamodelbyreconciling
differentperspective
•Avoidexcessmodelrevision,astheycan
distorttheessenceofyourmodel.

Introduction to the UML
•TheUMLisalanguagueforspecifying,constructing,
visualizinganddocumentingthesoftwaresystemandits
components.
•TheUMLisagraphicallanguagewithsetsofrulesand
semantic
•Therulesandsemanticsofamodelareexpressedin
english,inaformknownasobjectconstraint
language(OCL).
•OCLisaspecificationlanguagethatusessimplelogicfor
specifyingthepropertiesofasystem.
•TheUMLisnotintendedtobeavisualprogramming
languageinthesenseofhavingallthenecessaryvisualand
semanticsupporttoreplaceprogramminglanguages.

Introduction to the UML (Contd.)
•TheprimarygoalinthedesignoftheUMLwere
–Provideusersaready–to-use,expressivevisualmodeling
languagedevelopandexchangemeaningfulmodels
–Provideextensibilityandspecializationmechanismsto
extendthecoreconcepts
–Beindependentofparticularprogramminglanguagesand
developmentprocesses
–Provideaformalbasisforunderstandingthemodeling
language
–EncouragethegrowthoftheOOtoolsmarket
–Supporthigher-leveldevelopmentconcepts
–Integratebestpracticesandmethodologies

UML Diagrams
•Everycomplexsystemisbestapproachedthroughasmallsetofnearly
independentviewsofamodel;nosingleviewissufficient.
•TheUMLdefinesninegraphicaldiagrams
–Classdiagram(static)
–Use-casediagram
–Behaviordiagram(Dynamic)
•Interactiondiagram
–Sequencediagram
–Collaborationdiagram
•Statechartdiagram
•Activitydiagram
–Implementationdiagram
•Componentdiagram
•Deploymentdiagram

Use Case Diagram
•Used for describing a set of user scenarios
•Mainly used for capturing user requirements
•Work like a contractbetween end user and
software developers

Use Case Diagram (core components)
Actors:A role that a user plays with respect to the system,including
human users and other systems. e.g.,inanimate physical objects (e.g. robot);
an external system that needs some information from the current system.
Use case:A set of scenarios that describing an interaction between a user
and a system, including alternatives.
System boundary: rectangle diagram representing the boundary between
the actors and the system.

Use Case Diagram(core relationship)
Association:communication between an actor and
a use case; Represented by a solid line.
Generalization: relationship between one general
use case and a special use case (used for defining
special alternatives)
Represented by a line with a triangular arrow head
toward the parent use case.

Use Case Diagram(core relationship)
Extend: a dotted line labeled <<extend>> with an arrow
toward the base case.The extending use case may add behavior to
the base use case. The base class declares “extension points”.
<<extend>>
Include: a dotted line labeled <<include>> beginning at base
use case and ending with an arrows pointing to the include use
case. The include relationship occurs when a chunk of
behavior is similar across more than one use case. Use
“include” in stead of copying the description of that behavior.
<<include>>

Use Case Diagrams
Library System
Borrow
Order Title
Fine Remittance
Client
Employee
Supervisor
•A generalized description of how a system will be used.
•Provides an overview of the intended functionality of the system
Boundary
Actor
Use Case

Use Case Diagrams(cont.)
(TogetherSoft, Inc)

Use Case Diagrams(cont.)

Procedure for creating Actor
•InordertocreateActor,click[Toolbox]->[UseCase]->[Actor]
buttonandclickthepositionwheretoplaceActor.Actoris
shownintheformofstickmanorrectanglewithicon,thatis
decorationview.Todisplayactorindecorationview,select
[Format]->[StereotypeDisplay]->[Decoration]menuitemor
select[Decoration]itemincombobuttonontoolbar.

Procedure for creating UseCase
•InordertocreateUseCase,click[Toolbox]->[UseCase]button
andclickthepositionwheretoplaceUseCaseonthe[main
window].
•UseCaseisexpressedintheformsoftextual,decoration,
iconic.TochangeUseCase'sviewstyle,selectmenuitem
under[Format]->[StereotypeDisplay]orselectbutton's
comboitem.

Procedure for creating Actor from
UseCase
•InordertocreatemultipleActorsrelatedtoUseCaseatonce,
useshortcutcreationsyntax.
1.Double-clickUseCase,orselectUseCaseandpress[Enter]
key.Atquickdialog,enterActor'snameafter"()-"stringand
separateActornamesby","character.
2.Andpress[Enter]key.SeveralActorsassociatedwiththe
UseCasearecreatedandarrangedvertically.

Procedure for creating association
•Inordertocreateassociation,click[Toolbox]->
[UseCase]->[Association]button,dragfromfirst
element,anddroptosecondelementinthe[main
window].

Procedure for creating directed
association
•Theprocedureisequaltotheassociation's,draganddropin
thearrowdirection.
•Orcreateassociation,clicktheactor-sideassociationend.At
thequickdialog,unchecknavigableandassociationbecomes
directed.

Procedure for creating element related to
association/directed assocition
•Inordertocreateelementassociatedwithcurrentelement,
useshortcutcreationsyntax.
1.Double-clickelementandenterelement'snames
associatedafter"--"or"->"stringatthequickdialog.Separate
elementnameswith","charactertorelatemultipleelements.
2.Press[Enter]keyandseveralelementsassociatedwith
selectedelementarecreatedandarrangedautomatically.

Procedure for creating generalization
•Inordertomakegeneralization,click[Toolbox]->
[UseCase]->[Generalization]button,dragfromchild
elementanddroptoparentelementinthe[main
window].

Procedure for creating multiple child
actors inherited from actor
•Tocreatemultipleelementsinheritedfromsomeelement,
1.Enterwith"<="stringasfollowingatthequickdialog,and
severalelementsinheritedfromselectedelementarecreated
atonce.
2.Childelementsaregeneratedbelowselectedelementand
arrangedautomatically.

Procedure for creating dependency
•Inordertocreatedependency,click[Toolbox]->
[UseCase]->[Dependency]button,dragelementand
droptootherelementdepended

Procedure for creating other usecase
depended by current usecase
•Enterwith"-->"stringatthequickdialogas
following.
•Sodependencyrelationshipiscreatedbetweentwo
elements.

Procedure for creating include
•Inordertocreateincluderelationship,click[Toolbox]
->[UseCase]->[Include]button,dragfromelement
includinganddroptoelementincludedinthe[main
window].

Procedure for creating other usecase
included by current usecase
•Enterwith"-i>"stringatthequickdialogasfollowing
•Soincluderelationshipiscreatedbetweentwo
elements.

Procedure for creating extend
•Inordertocreateextend,click[Toolbox]->[UseCase]
->[Extend]button,dragfromelementextendingand
droptoelementextendedinthe[mainwindow].

Procedure for creating other usecase
extending current usecase
•Enterwith"<e-"stringatthequickdialogas
following.
•Soextendrelationshipiscreatedbetweentwo
elements

Procedure for creating system
boundary
•Inordertocreatesystemboundary,click[Toolbox]->
[UseCase]->[SystemBoundary]button,dragfrom
thestartingpointofsystemboundaryanddragto
right-bottompointofsystemboundary.

Procedure for creating package
•Inordertocreatepackage,click[Toolbox]->
[UseCase]->[Package]buttonandclickatthe
locationwherepackagewillbeplacedinthe[main
window].

Class Diagram
•Itisalsoreferredtoasobjectmodeling,isthemain
staticanalysisdiagram.
•Aclassdiagramisacollectionofstaticmodeling
elements,suchasclassesandtheirrelationships,
connectedasagraphtoeachotherandtotheir
contents.
•Forexamplethethingsthatexist,theirinternal
structures,andtheirrelationshipstootherclasses.
•Classdiagramsdonotshowtemporalinformation,
whichisrequiredindynamicmodeling.

Class Diagram
•Objectmodelingistheprocessbywhichthelogical
objectsintherealworldarerepresentedbythe
actualobjectsintheprogram.
•Thisvisualrepresentationoftheobjects,their
relationships,andtheirstructuresisforeaseof
understanding.
•Toeffectivelydevelopamodeloftherealworld
andtodeterminetheobjectsrequiredinthe
system,youfirstmustaskwhatobjectsareneeded
tomodelthesystem.

Class Diagram
•Answeringthefollowingquestionswillhelpyoutostay
focusedontheproblemathandanddeterminewhatisinside
theproblemdomainandwhatisoutsideit:
–Whatarethegoalsofthesystem?
–Whatmustthesystemaccomplish?
•Youneedtoknowwhatobjectswillformthesystembecause,
intheobjectorientedviewpoint,objectsaretheprimary
abstraction,.
•Themaintaskofobjectmodelingistographicallyshowwhat
eachwilldointheproblemdomain,describesthestructure
andtherelationshipsamongobjectsbyvisualnotations,and
determinewhatbehaviorsfallwithinandoutsidetheproblem
domain.

Class Notation: Static Structure
•Aclassisdrawnasarectanglewiththreecomponentsseparatedby
horizontallines.
•Thetopnamecompartmentholdstheclassname,othergeneral
propertiesoftheclass,suchasattributes,areinthemiddle
compartment,andthebottomcompartmentholdsalistof
operations.
•Eitherorboththeattributeandoperationcompartmentsmaybe
suppressed.
•Aseparatorlineisnotdrawnforamissingcompartmentifa
compartmentissuppressed;noinferencecanbedrawnaboutthe
presenceorabsenceofelementsinit.
•Theclassnameandotherpropertiesshouldbedisplayedinupto
threesections.
•AstylisticconventionofUMListouseanitalicfontforabstract
classesandanormal(roman)fontforconcreteclasses.

Class Diagram

Object Diagram
•Astaticobjectdiagramisaninstanceofaclass
diagram.
•Itshowsasnapshotofthedetailedstateofthe
systematapointintime.
•Notationisthesameforanobjectdiagramand
aclassdiagram.
•Classdiagramcancontainobjects,soaclass
diagramwithobjectsandnoclassesisanobject
diagram.

Class Interface notation
•Classinterfacenotationisusedtodescribetheexternallyvisible
behaviorofaclass;forexample,anoperationwithpublicvisibility.
•IdentifyingclassinterfacesisadesignactivityofOOSD.
•TheUMLnotationforaninterfaceisasmallcirclewiththenameof
theconnectedtotheclass.
•Aclassthatrequirestheoperationsintheinterfacemaybe
attachedtothecirclebyadashedarrow.
•Thedependentclassisnotrequiredtoactuallyuseallofthe
operations.
•Forexample,apersonobjectmayneedtointeractwiththe
BankAccountobjecttogetthebalance;thisrelationshipisdepicted
withUMLclassinterfacenotation.

Binary association notation
•Abinaryassociationisdrawnasasolidpathconnectingtwo
classes,orbothendsmaybeconnectedtothesameclass.
•Anassociationmayhaveanassociationname.
•Theassociationnamemayhaveanoptionalblacktrianglein
it,thepointofthetriangleindicatingthedirectioninwhichto
readthename.
•Theendofanassociation,whereitconnectstoaclass,is
calledtheassociationrole.
marriedTo

Association Role
•Asimpleassociation–thetechnicaltermforitisbinaryassociation
–isdrawnasasolidlineconnectingtwoclasssymbols.
•Theendofanassociation,whereitconnectstoaclass,showsthe
associationrole.
•Theroleispartoftheassociation,notpartoftheclass.
•Eachassociationhastwoormorerolestowhichitisconnected.
•TheUMLusesthetermassociationnavigationornavigabilityto
specifyaroleaffiliatedwitheachendofanassociationrelationship.
•Anarrowmaybeattachedtotheendofthepathtoindicatethat
navigationissupportedinthedirectionofclasspointedto.
•Anarrowmaybeattachedtoneither,one,orbothendsofthepath.

Qualifier
•Aqualifierisanassociationattribute.
•Forexample,apersonobjectmaybeassociatedtoabankobject.
•Anattributeofthisassociationistheaccount#.
•Theaccount#isthequalifierofthisassociation.
•Aqualifierisshownasasmallrectangleattachedtotheendofan
associationpath,betweenthefinalpathsegmentandthesymbol
oftheclasstowhichitconnects.
•Thequalifierrectangleispartoftheassociationpath,notpartof
theclass.
•Thequalifierrectangleusuallyissmallerthantheattachedclass
rectangle.
account#
*
0…1

Multiplicity
•Multiplicityspecifiestherangeofallowableassociated
classes.
•Itisgivenforroleswithinassociation,partswithin
compositions,repetitions,andotherpurposes.
•Amultiplicityspecificationisshownasatextstring
comprisingaperiodseparatedsequenceofinteger
intervals,whereanintervalrepresentsarangeof
integersinthisformat
lowerbound..Upperbound
0..1
0..*
1..3,7..10,15,19..*
account#
*
0…1

OR Association
•AnOrassociationindicatesasituationinwhichonlyoneofseveral
potentialassociationmayinstantiatedatonetimeforanysingle
object.
•Thisisshownasadashedlineconnectingtwoormoreassociation,
allofwhichmusthaveaclassincommon,withtheconstraint
string{0r}labelingthedashedline.
•Inotherwords,anyinstanceoftheclassmayparticipatein,atmost,
oneoftheassociationatonetime.
Car
Person
Company
{or}

Association Class
•Anassociationclassisanassociationthatalsohasclassproperties.
•Anassociationclassinshownasaclasssymbolattachedbya
dashedlinetoanassociationpath.
•Thenameintheclasssymbolandthenamestringattachedtothe
associationpatharethesame.
•Thenamecanbeshownonthepathorclasssymbolorboth.
•Ifanassociationclasshasattributesbutnooperationsorother
association,thenthenamebedisplayedontheassociationpath
andomittedfromtheassociationclasstoemphasizeits“
associationnature”.
•Ifithasoperationsandattributes,thenthenamemaybeomitted
fromthepathandplacedintheclassrectangletoemphasizeits
“classnature”.

Association Class

N-ary Association
•Ann-aryassociationisanassociationamongmorethan
twoclasses.
•Ann-aryassociationisshownasalargediamondwitha
pathfromthediamondtoeachparticipantclass.
•Thenameoftheassociationisshownnearthediamond.
•Theroleattachmentmayappearoneachpathaswitha
binaryassociation.
•Multiplicitymaybeindicated;however,qualifiersand
aggregationarenotpermitted.
•Anassociationclasssymbolmaybeattachedtothe
diamondbyadashedline,Indicatingann-aryassociation
thathasattributes,operation,orassociations.

N-ary Association

Aggregation
•Aggregationisaformofassociation.
•Ahollowdiamondisattachedtotheendofthepath
toindicateaggregation.
•Thediamondmaynotbeattachedtobothendsofa
line,anditneednotbepresentedatall.

Composition
•Italsoknowasthea-part-of,isaformofaggregationwith
strongownershiptorepresentthecomponentofacomplex
object.
•Compositionalsoisreferredtoasapart-wholerelationship.
•TheUMLnotationforcompositionisasoliddiamondatthe
endofapath.
•Alternatively,theUMLprovidesagraphicallynestedform
that,inmanycases,ismoreconvenientforshowing
composition.
•Partswithmultiplicitygreaterthanonemaybecreatedafter
theaggregateitselfbut,oncecreated,theyliveanddiewith
it.
•Suchpartscanalsoexplicitlyremovedbeforethedeathofthe
aggregate.

Generalization
•Generalizationistherelationshipbetweenamoregeneralclassand
amorespecificclass.
•Generalizationisdisplayedasadirectedlinewithaclosed,hollow
arrowheadatthesuperclassend.
•TheUMLallowsadiscriminatorlabeltobeattachedtoa
generalizationofthesuperclass.
•Ellipse(….)indicatethatthegeneralizationisincompleteandmore
subclassesexitthatarenotshown.
•Theconstructorcompleteindicatesthatthegeneralizationis
completeandnomoresubclassesareneeded.
•Ifatextlabelisplacedonthehollowtrianglesharedbyseveral
generalizationpathstosubclasses,thelabelappliestoallofthe
paths.
•Inotherwords,allsubclassessharethegivenproperties.

Generalization Example

Generalization Example

Visual Paradigm for UML