Unified Modeling Language (UML)OverviewUMLUML MotivationDefinitionsModels & ViewsSlide 7UML Views(Some) UML DiagramsUML ConventionsClass DiagramsSequence DiagramUse Case DiagramsState DiagramsUML Sequence DiagramsSequence Diagram NotationSequence Diagram ExampleUML Class DiagramsSlide 19Slide 20Sequence Diagram ObservationsUML Class Diagrams Java CodeJava UML : Clock ExampleJava UML : Printing SystemSlide 25Slide 26UML Java : Printing SystemSummaryUnified Modeling Language (UML)Nelson Padua-PerezChau-Wen TsengDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewUnified Modeling Language (UML)Models & viewsClass diagramsSequence diagramsUMLUML (Unified Modeling Language)Graphic modeling language for describing object-oriented softwareStarted in 1994Combined notations from 3 leading OO methodsOMT (James Rumbaugh)OOSE (Ivar Jacobson)Booch (Grady Booch)UML MotivationSoftware growing larger & complexDifficult to analyzeNeed to describe software designClearlyConciselyCorrectlyUML equivalent to software “blueprint”Provides simple yet clear abstraction for softwareComputer-aided software engineering (CASE)Tools for generating & analyzing UMLDefinitionsModelAbstraction describing (all or part of) system ViewDepicts selected aspects of a model using set of diagramsDiagramActual depiction of aspect of modelNotationSet of graphical / textual rules for representing viewModels & ViewsSystemModel 1Model 2View 1View 3View 2UMLIndustry standard Many featuresLarge collection of notationsMultiple viewsMultiple diagramsWe focus mainly onLogical view of relationship between classesUML ViewsUse-CaseShow external user (actor) view of system LogicalShow how functionality is implementedComponentShow organization of code componentsDeploymentShow assignment of code to physical computers(Some) UML DiagramsClassDescribe static structure of the classes in system SequenceDescribe dynamic behavior between users and objects Use caseDescribe functional behavior seen by (external) userStateDescribe dynamic behavior of objects as finite state machineActivityModel dynamic behavior of a system as a flowchartUML ConventionsRectangles classes or instancesOvals functions or use casesTypes preceded by colon, not underlined:SimpleWatchInstances underlined namesmyWatch:SimpleWatchDiagrams graphsNodes entitiesArcs relationships between entitiesClass DiagramsBatteryload()12Timenow()PushButtonstatepush()release()111112blinkIdxblinkSeconds()blinkMinutes()blinkHours()stopBlinking()referesh()LCDDisplaySimpleWatchClassAssociationMultiplicityAttributesOperationsClass diagrams represent structure of systemSequence DiagramObjectMessageActivationSequence diagrams represent behavior as interactionsblinkHours()blinkMinutes()incrementMinutes()refresh()commitNewTime()stopBlinking()pressButton1()pressButton2()pressButtons1And2()pressButton1():WatchUser:Time:LCDDisplay:SimpleWatchUse Case DiagramsWatchUser WatchRepairPersonReadTimeSetTimeChangeBatteryActorUse casePackageSimpleWatchUse case diagrams represent functionality of system from external user’s point of viewbutton1&2Pressedbutton1&2Pressedbutton1Pressedbutton2Pressedbutton2Pressedbutton2Pressedbutton1Pressedbutton1&2PressedIncrementMinutesIncrementHoursBlinkHoursBlinkSecondsBlinkMinutesIncrementSecondsStopBlinkingState DiagramsStateInitial stateFinal stateTransitionEventUML Sequence DiagramsRepresent behavior in terms of interactions During requirements analysisUsed to refine use case descriptionsDuring system design Used to refine subsystem interfacesSequence Diagram NotationColumns Classes Arrows MessagesNarrow rectangles ActivationsSequence Diagram ExampleSequence of events for printer queueUML Class DiagramsRepresent the (static) structure of the systemDuring analysis Used to model problem domain conceptsDuring detailed design Used to model classesClass DiagramsClass containsNameStateBehaviorClass DiagramsTypes may be includedOnly class name is requiredSequence Diagram ObservationsRepresents behavior in terms of interactionsComplement the class diagrams which represent structureUseful for finding participating objectsUML Class Diagrams Java CodeDifferent representation of same informationName, state, behavior of classRelationship(s) between classesShould be able to derive one from the other MotivationUML JavaImplement code based on design written in UMLJava UMLCreate UML to document design of existing codeJava UML : Clock ExampleJavaclass Clock // name{// stateint seconds;int minutes;int hours;// behaviorvoid start();void adjustTime();void reset();}Java CodeClass DiagramJava UML : Printing SystemJavaclass Job {}class Registry {PrintQueue findQueue();}Java UML : Printing SystemJavaclass PrintQueue {List printJobs;Printer myPrinter;Registry myRegistry;void newJob();int length();Resources getResource();}Java UML : Printing SystemJavaclass Printer {Resources myResources;Job curJob;void print();boolean busy();boolean on();}UML Java : Printing SystemJavaclass Printer {Resources myResources;Job curJob;void print();boolean busy();boolean on();}UMLSummaryOverview of UMLFocus on class diagramsHow they represent structure of softwareConversion to/from JavaNext lecture will examineHow UML represents relationships between classesMore UML Java
View Full Document