BASICS OF UML (PART-2) 1
USE CASE DIAGRAMS 2
USE CASE DIAGRAMS Use Case Model: a view of a system that emphasizes the behavior as it appears to outside users. A use case model partitions system functionality into transactions ( use cases ) that are meaningful to users ( actors ). 3
USE CASE: CORE ELEMENTS Construct Description Syntax use case actor system boundary A sequence of actions, including variants, that a system (or other entity) can perform, interacting with actors of the system. A coherent set of roles that users of use cases play when interacting with these use cases. Represents the boundary between the physical system and the actors who interact with the physical system. UseCaseName ActorName 4
USE CASE: CORE ELEMENTS Construct Description Syntax association The participation of an actor in a use case. i.e., instance of an actor and instances of a use case communicate with each other. generalization A taxonomic relationship between a more general use case and a more specific use case. 5
USE CASE: CORE ELEMENTS Shows use cases, actor and their relationships. Use case internals can be specified by text and/or interaction diagrams. Kinds use case diagram use case description 6
USE CASE: EXAMPLE T e l e p h o n e C a t a lo g C h e c k s t a t u s P la c e o r d e r S a l e s p e r s o n C u s t o m e r Fill orders S h ip p in g C le r k E s t a b l is h c re d i t S u p e r v i s o r 7
STATE DIAGRAMS 8
STATE DIAGRAM A State diagram is a visual representation of an object's state. It shows the life of an object from birth to death. In this type of diagram, you see the behavior specifying the sequence of states that the object goes through in response to events over its lifetime, and you see the object's responses to those events. 9
STATE DIAGRAM: SYMBOLS Initial State A filled circle followed by an arrow represents the object's initial state. Final State States Transition An arrow pointing to a filled circle nested inside another circle represents the object's final state. States represent situations during the life of an object. You can easily illustrate a state in SmartDraw by using a rectangle with rounded corners. solid arrow represents the path between different states of an object. Label the transition with the event that triggered it and the action that results from it. 10
STATE DIAGRAM: EXAMPLE Toster Example A Toaster object undergoes three states in its lifycycle: On Working Shut Down 11
SEQUENCE DIAGRAMS 12
SEQUENCE DIAGRAM UML sequence diagrams are used to represent or model the flow of messages, events and actions between the objects or components of a system. Time is represented in the vertical direction showing the sequence of interactions of the header elements, which are displayed horizontally at the top of the diagram. Sequence Diagrams are used primarily to design, document and validate the architecture, interfaces and logic of the system by describing the sequence of actions that need to be performed to complete a task or scenario. UML sequence diagrams are useful design tools because they provide a dynamic view of the system behavior which can be difficult to extract from static diagrams or specifications. 13
SEQUENCE DIAGRAM: ELEMENTS Object Call Message Destroy Element Return Message Represents an object in the system or one of its components A call (procedure) message between header elements Represents the destruction of a header element A return message between header elements 14
SEQUENCE DIAGRAM: ELEMENTS Diagram Link Represents a portion of a diagram being treated as a functional block. Similar to a procedure or function call that abstracts functionality or details not shown at this level. Can optionally be linked to another diagram for elaboration 15
SEQUENCE DIAGRAM: EXAMPLE SELF SERVICE MACHINE Let's assume that in the self-service machine, three objects do the work we're concerned with: The Front: the interface the self-service machine presents to the customer The Money Register: part of the machine where moneys are collected The Dispenser: which delivers the selected product to the customer 16
SEQUENCE DIAGRAM: EXAMPLE SELF SERVICE MACHINE The instance sequence diagram may be sketched by using this sequences: 1. The customer inserts money in the money slot. 2. The customer makes a selection. 3. The money travels to the register. 4. The register checks to see whether the selected product is in the dispenser. 5. The register updates its cash reserve. 6. The register has a dispenser deliver the product to the front of the machine. 17
SEQUENCE DIAGRAM: EXAMPLE SELF SERVICE MACHINE 18
ACTIVITY DIAGRAM 19
ACTIVITY DIAGRAM: EXAMPLE Activity diagrams represent the business and operational workflows of a system. An Activity diagram is a dynamic diagram that shows the activity and the event that causes the object to be in the particular state. An activity diagram represents the business and operational step-by-step workflows of components in a system. 20
ACTIVITY DIAGRAM: ELEMENTS Initial Activity Activity Decisions This shows the starting point or first activity of the flow. Denoted by a solid circle. This is similar to the notation used for Initial State Represented by a rectangle with rounded (almost oval) edges. Similar to flowcharts, a logic where a decision is to be made is depicted by a diamond, with the options written on either sides of the arrows emerging from the diamond, within box brackets. 21
ACTIVITY DIAGRAM: ELEMENTS Concurrent Activities Final Activity Some activities occur simultaneously or in parallel. Such activities are called concurrent activities. For example, listening to the lecturer and looking at the blackboard is a parallel activity. This is represented by a horizontal split (thick dark line) and the two concurrent activities next to each other, and the horizontal line again to show the end of the parallel activity. The end of the Activity diagram is shown by a bull's eye symbol, also called as a final activity. 22
ACTIVITY DIAGRAM: EXAMPLE Let us consider the example of attending a course lecture, at 8 am The sequence of activities are: 1. The first activity is to get dressed to leave for the lecture. 2. A decision then has to be made, depending on the time available for the lecture to start, and the timings of the public trains (metro). 3. If there is sufficient time to catch the train, then take the train else flag down a cab to the University. 4. The final activity is to actually attend the lecture, after which the Activity diagram terminates. 23
ACTIVITY DIAGRAM: EXAMPLE 24
RESOURCES OMG UML Resource Page Object Management Group (OMG) provides the newest UML standards, add-ons and features on their site. www.uml.org/ Tutorials: OMG'S List of Training in OMG Technologies including UML http://www.omg.org/gettingstarted/training.htm Borland's UML Tutoria http://bdn.borland.com/article/0,1410,31863,00.htmll Cetus Links - UML Tutorials http://www.cetus-links.org/oo_uml.html#oo_uml_tutorials Embarcadero Technologies - UML Tutorials http://www.embarcadero.com/support/uml_central.asp#tutorials Mario Jeckle - UML Tutorials http://www.jeckle.de/umllinks.htm#tutorials Sun Microsystems' UML Tutorials http://developers.sun.com/prodtech/javatools/jsenterprise/learning/tutorials/index.html 25
UML TOOLS Microsoft Visio Provides trial version to download. Download Link: office.microsoft.com/visio Visual Paradigm (VP-UML CE) Provides community edition for free download. Download Link: www.visual-paradigm.com/product/vpuml/communityedition.jsp Smart Draw Provides 15-Day Trial Version. Download Link: www.smartdraw.com/downloads/ Rational Rose Provides 30-Day Trial Version. Download Link: www.ibm.com/developerworks/downloads/r/rrrt/ 26
27
28