UML Representations Components of the UML • • • • • • • • • Class Diagram Object Diagram Use Case Diagram State Diagram Sequence Diagram Activity Diagram Collaboration Diagram Component Diagram Deployment Diagram The Use Case Diagram • It contains use cases and actors, illustrating the relationships between the two sets. • These diagrams are usually the starting point of the analysis phase when designing a system. • Use cases show the overall structure and availability in a system to non-technical readers such as management and end users. A use case consists of: • A System that performs a function. A system has defined boundaries and can be broken down into sub-systems. Microsoft Visio use case diagram for a system is shown below. System A use case consists of (contd.) • An Actor(s) is used to represent something that uses a system. An actor can be a person or another system. Microsoft Visio uses following diagram to represent an actor. Actor1 A Use Case Consists of • Use cases which represent actions that a user takes on a system. Use cases are represented by an ellipse. Following diagram represents a use case diagram for a developer developing software. -End1 -End2 develop software * Developer * The Use Case Diagram Soda Machine * Buy Soda * * * Customer Customer * Collect * * * Collector Collector Use Case Actors (humans or external Systems)System (How to use the system And its behavior) The Hierarchy of Actors in Use Case Employee Corporate Officer Office Manager Manager Consultant Project Manager Network Administrator Clerical Staff The Class and Object Diagrams • A class diagram is used to represent different classes, their relationship to each other, and which subsystem they belong to. • Object diagram shows instances of classes. • Class diagram is more generic and object diagram is more specific. Class and Object Diagrams Class Diagram Textbook Course -Author : String -Price : double -ID : String -Name : String IST411 : Course Object Diagrams ID : String = IST411 Name : String = Dist. Obj. Comp. Required : Textbook Optional : Textbook Author : String = Emmerich Price : double = 75.00 Author : String = Asbury Price : double = 50.00 Activity Diagram • The activity diagram is used to analyze the behavior within more complex use cases and show their interaction with each other. Activity diagrams are used early in the system’s development process and are usually used to represent more complicated business activities. A Use Case and Activity Diagram Records Record Grades Teacher Select Student Enter Grades Save Grades An Activity Diagram with a Decision Select Student Enter Grades No grades exists Insert Grades Grades alreay exists Update Grades An Activity Diagram with a Fork and a Join for a parallel process Start Application Draw Controls on Screen Initialize Variables Populate Controls on Screen Give User Access The Sequence Diagram • The sequence diagram is used to show interaction between actors and objects and other objects. Messages are sent from actor to object, object to object and object to actor to show the flow of control through a system. Sequence diagrams are use to realize use cases by documenting how a use case is solved with the current design of the system. Sequence Diagrams :GUI :Operating System :Monitor :CPU Keystroke() () () () User () Feedback() Time The Sequence • The GUI notifies the operating system about the keystroke. • The operating system notifies the CPU. • The CPU sends a message to the monitor. • The monitor presents the alphanumeric character on screen, providing visual feed back to the user. The Connections in Sequence Diagrams () Asynchronous Connection (The actor can Continue to work while action is taken by the System) () Synchronous Connection (The actor has to wait for system approval) () Simple Message (Transfers control from one object to another ) Statechart diagrams • Statechart diagrams look similar to activity diagrams and are sometimes confusing. An activity diagram is used to model how different areas of work behave with each other and interact, a statechart diagram is used to represent a single object and how its behavior causes it to change state. The State Diagram • Class and Object diagrams model system statically. • State Diagram represent the dynamic behavior/flow of the system. • State diagrams are used between systems analysis and design phase. UML Symbols for State Diagram State Initial Starting Point End Point The State Diagram (object is a PC) / Turn PC on / Shut Down Initializing Working Shutting Down Collaboration Diagram • Collaboration diagrams are used to bring class diagrams to the next step. They represent the interaction and the relationships between the objects created in earlier steps of the domain modeling process. • Collaboration diagrams are often drawn between class and sequence diagrams. A Colloboration Diagram 2: Verify Login Login Form User 1: Attempt Login User 3: Load User 5: Set Current User 6: Set Permissions 11: Log Action PMA Database 4: Load User Info Speech Module 10: Load Speech profile Permission AdminManager 7: Load Permissions 9: Set Permissions PMA Modules 8: Load Permissions Info Component Diagrams • Component diagrams model software components and their relationships with each other. • A component is a single piece of software. It can be a file, product, executable, script or so on. A UML Component Diagram Propaq Brentwood <<EKG>> SonoSite Hardware <<Ultrasound>> Spot Vitals Monitor <<Vitals> EKG Pulse OX Display <<VB Form>> OBDC PMA Database <<Access>> Printer External Printer <<Device>> Ultrasound Propaq Brentwood Display <<VB <<EKG>> Form>> Vitals Display <<VB Form>> Deployment Diagrams • Deployment diagrams are used to model hardware as it relates to the deployment of the system that you are modeling in UML. • A deployment diagram has only two major pieces of its notation, the node and the communication association. A deployment diagram Printer ClientPC Web Server Http USB The diagram illustrates that a Web Server interacts with a ClientPC via an HTTP protocol, and the ClientPC communicates with a printer via a USB protocol. Component and Deployment Diagrams ClientComputer UserInterface BusinessLogic * -WAN * DatabaseRoutines ServerComputer BackendFunctionality Credits/Further Reading • Some Information was taken and modified from UML: A Beginners Guide by Jason T. Roff, McGraw Hill.