280 likes | 450 Views
MCS 270 Spring 2014. Object-Oriented Software Development. MCS 270 Object-Oriented Software Development. Today ’ s schedule. Interaction Modeling: Use Case Model Sequence Model Activity Model Adapted from Software Engineering, Spring 2006, NYU
E N D
MCS 270 Spring 2014 Object-Oriented Software Development
MCS 270 Object-Oriented Software Development Today’s schedule Interaction Modeling: Use Case Model Sequence Model Activity Model Adapted from Software Engineering, Spring 2006, NYU http://cs.nyu.edu/courses/spring06/V22.0474-001
MCS 270 Object-Oriented Software Development Unified modeling language (UML) • Class model: describes the static structure of objects and relationships in a system • Comprises object and class diagrams • State model:describes the dynamic aspects (life cycles) of objects and the nature of control in a system • Interaction model: describes how objects in a system interact to achieve broader results
MCS 270 Object-Oriented Software Development Interaction Modeling: Use Cases • A use case names a type of user (actor) and something that they want to do (usecase). • An actor is an externaluser of a system. Can be a human, a device, or a piece of software. • The use case describes how an actor achieves a specific tangible goal.
MCS 270 Object-Oriented Software Development Interaction Modeling: Use Cases • Usecase can consist of: • Textual Description: Name, Summary, Actors, Entry conditions, Exit conditions, Exceptions or Errors, Event-Flow Description • UseCase Diagram: Graphical (Brief!) summary of use case
MCS 270 Object-Oriented Software Development Example: Use-Case Description • Name: Normal Subway Ride • Summary: A passenger takes a subway ride • Actors: Passenger • Entry Condition: Passenger at start station • Exit Condition: Passenger leaves end station • Exceptions: Out of tickets, Train in repair, Train Derail, Door won’t open, Miss stop station
MCS 270 Object-Oriented Software Development Example: Use-Case Description Event-flow Description Passenger purchases ticket/has pre-purchased ticket Train arrives and stops at platform Doors open Passenger steps into train Doors close Passenger presses request button for final stop Doors open at final stop Passenger exits train
Ride Repair MCS 270 Object-Oriented Software Development Example: Use Case Diagram Boundary for all use cases • Graph showing • Actors • Use cases • Edge: actor-case if that actor is involved in that case • Actors • Stick figures • Use cases • Ovals passenger technician
MCS 270 Object-Oriented Software Development Exceptional Situations • Includerelationships • “Buy Ticket” use case is included in Ride use case. • Extend relationships • Expresses an exceptional variation of a use case • Normally used to express errors
Buy Ticket Ride Repair Derail MCS 270 Object-Oriented Software Development <<include>> <<extend>> passenger technician
MCS 270 Object-Oriented Software Development Summary of Use Cases • Use Case Diagram • Shows all actors, use cases, relationships • Actors are agents external to the system • Use Case Description – information for single Use case • Entry/Exit Conditions, Story, Main and Alternative Event flows, Exceptions • Specified in a separate document • Report style – complete sentences, etc
MCS 270 Object-Oriented Software Development Interaction Modeling: Sequence Model • Sequences elaborate Use Cases - consist of: • Textual Scenario: Sequence of events occurring a specific event sequence in a system (could be a use case) • Sequence Diagram: Graphical summary of participants (Actors, Objects) and messages between participants through time
MCS 270 Object-Oriented Software Development Sequence Diagram Sequence Diagram is a table Columns are classes or actors (lifelines) Rows are time steps (time flows from top to bottom) Horizontal Arrows show control/data flow Method calls Important changes in state Specific Diagram for each task
Classes & Actors MCS 270 Object-Oriented Software Development Example Sequence Diagram Passenger Station Train buyTicket() arrives openDoors() closeDoors() pushButton(S)
MCS 270 Object-Oriented Software Development Example Sequence Diagram Passenger Station Train Method Call Note: These are all synchronous method calls. There are other kinds of invocations. buyTicket() arrives openDoors() closeDoors() pushButton(S)
MCS 270 Object-Oriented Software Development Example Sequence Diagram Passenger Station Train Invocation lifetime spans lifetimes of all nested invocations buyTicket() arrives openDoors() closeDoors() pushButton(S)
Example Sequence Diagram Passenger Station Train “Lifelines” fill in time between invocations buyTicket() arrives openDoors() closeDoors() pushButton(S)
MCS 270 Object-Oriented Software Development Interaction Modeling: Activity Model • Activity Model consists of: • Activity Diagram: Flow Chart of operations of application
Activities in roundtangles buyTicket board MCS 270 Object-Oriented Software Development Example Activity Diagram Station Train trainArrive
buyTicket board MCS 270 Object-Oriented Software Development Example Activity Diagram Station Train Fork trainArrive Concurrency Join
buyTicket board MCS 270 Object-Oriented Software Development Example Activity Diagram Swim lanes show which classes/actors are responsible for which part of the diagram Station Train trainArrive
Flow-chart if-then stopTrain announceNoStop MCS 270 Object-Oriented Software Development Example Activity Diagram StopRequested? yes no
MCS 270 Object-Oriented Software Development Overview on Using UML: What’s Good A common language Makes it easier to share requirements, specs, designs Visual syntax is useful, to a point A picture is worth 1000 words For the non-programmer, easier to grasp simple diagrams than simple code/pseudo-code To the extent UML is precise, forces clarity Much better than natural language Commercial tool support Tools for UML -> code or vice-versa
MCS 270 Object-Oriented Software Development Overview on Using UML: What’s Not so Good Hodge-podge of ideas Union of most popular modeling languages Visual syntax does not scale well Many details are hard to depict visually Ad hoc text attached to diagrams No visualization advantage for large diagrams 1000 pictures are very hard to understand Semantics is not completely clear Some parts of UML underspecified, inconsistent
MCS 270 Object-Oriented Software Development Why use UML? UML is being widely adopted By users By tool vendors By programmers A step forward Better than just diving in and coding! First standard for high-levels of software process Expect further evolution, development of UML
MCS 270 Object-Oriented Software Development Suggestions on using UML Discovering Requirements for Code Use Case Diagrams/Descriptions to illustrate use cases Activity or Sequence Diagrams to illustrate typical flow within a use case (scenarios) Design Class Diagram for system architecture
MCS 270 Object-Oriented Software Development Use Case Exercise • Groups of 3-4: Create a Use Case analysis of “GusList” – an on-line classified ad service for the Gustavus community. • Ideal: Design use cases in conversation with users (Students, Faculty, Staff) • Next Best – You will practice this in conversation with each other. • Task: Identify • Actors • Use Case Names (General) • By next Tuesday, prepare (individually) a Requirements statement and a use case document. • Document contains: Requirements statement. Use Case diagram(s). At least two fully developed Textual Descriptions.
MCS 270 Object-Oriented Software Development Assignments Friday – Read Chapters 10,11 Continue GusList Use Case Project Homework: Chapter 5. Exercises 5.3, 5.4 Programming: Interfaces Due Tomorrow: Friday, Feb. 21