06 system sequence diagrams

Upload: zaineb-khalil

Post on 14-Oct-2015

37 views

Category:

Documents


0 download

DESCRIPTION

sequence

TRANSCRIPT

  • System Sequence DiagramsBased on Craig Larman, Chapter 10and Anuradha Dharanis notes

  • Dynamic behaviorsClass diagrams represent static relationships. Why?What about modeling dynamic behavior?Interaction diagrams model how groups of object collaborate to perform some behaviorTypically captures the behavior of a single use case

    Use Case: Order Entry1) An Order Entry window sends a prepare message to an Order2) The Order sends prepare to each Order Line on the Order3) Each Order Line checks the given Stock Item4) Remove appropriate quantity of Stock Item from stock 5) Create a deliver item

    Alternative: Insufficient Stock3a) if Stock Item falls below reorder levelthen Stock Item requests reorder

  • Sequence diagramsVertical line is called an objects lifelineRepresents an objects life during interactionObject deletion denoted by X, ending a lifelineHorizontal arrow is a message between two objectsOrder of messages sequences top to bottomMessages labeled with message nameOptionally arguments and control informationControl information may express conditions: such as [hasStock], or iterationReturns (dashed lines) are optionalUse them to add clarity

  • A time for systems analysisTo every thing there is a season, and a time to every purpose under heaven. Ecclesiastes 3:1What UP phase are your projects in?What have you determined about your projects?Preliminary requirements analysis determines a vision and scope, use cases, risks and estimatesI.e., is there a project worthy of pursuing?Next comes systems analysis:Clarifies input and output System events and which Objects trigger themGenerates System Sequence Diagrams from Use CasesWhy does this activity make sense now?

  • System Sequence Diagram (SSD)For a use case scenario, an SSD shows:The System (as a black box) The external actors that interact with SystemThe System events that the actors generateSSD shows operations of the System in response to events, in temporal orderDevelop SSDs for the main success scenario of a selected use case, then frequent and salient alternative scenarios

    :System

  • SSD for Process Sale scenario(Larman, page 175)

  • From Use Case to Sequence System DiagramHow to construct an SSD from a use case:Draw System as black box on right side For each actor that directly operates on the System, draw a stick figure and a lifeline.For each System events that each actor generates in use case, draw a message.Optionally, include use case text to left of diagram.

  • Example: use cases to SSD

  • Identifying the right Actor

    In the process Sale example, does the customer interact directly with the POS system? Who does?Cashier interacts with the system directlyCashier is the generator of the system eventsWhy is this an important observation?

  • Naming System events & operationsSystem events and associated system operations should be expressed at the level of intent Rather than physical input medium or UI widgetStart operation names with verb (from use case)Which is better, scanBarCode or enterItem?

  • SSDs and the Glossary in parallelWhy is updating the glossary important when developing the SSD?New terms used in SSDs may need explanation, especially if they are not derived from use cases A glossary is less formal, easier to maintain and more intuitive to discuss with external parties such as customers

  • SSDs within the Unified ProcessCreate System Sequence Diagrams during Elaboration in order to:Identify System events and major operationsWrite System operation contracts (Contracts describe detailed system behavior) Support better estimatesRemember, there is a season for everything: it is not necessary to create SSDs for all scenarios of all use cases, at least not at the same time

  • Concurrency in Sequence Diagrams

    Concurrent processes: UML 1: asynchronous messages as horizontal lines with half arrow headsUML 2 makes this distinction by not filling an arrowhead Fowler prefers older notation. Why? Which do you prefer?After setting up Transaction Coordinator, invoke concurrent Transaction CheckersIf a check fails, kill all Transaction Checker processesNote use of comments in marginWhen is this a good idea?

  • Collaboration diagramsObjects are rectangular iconse.g., Order Entry Window, Order, etc.Messages are arrows between iconse.g., prepare()Numbers on messages indicate sequenceAlso spatial layout helps show flowWhich do you prefer: sequence or collaboration diagrams?Fowler now admits he doesnt use collaboration diagramsInteraction diagrams show flow clearly, but are awkward when modeling alternativesUML notation for control logic has changed in UML 2 but Fowler isnt impressed