Presentation is loading. Please wait.

Presentation is loading. Please wait.

MCS 270 Spring 2014 Object-Oriented Software Development.

Similar presentations


Presentation on theme: "MCS 270 Spring 2014 Object-Oriented Software Development."— Presentation transcript:

1 MCS 270 Spring 2014 Object-Oriented Software Development

2 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

3 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 Unified modeling language (UML) MCS 270 Object-Oriented Software Development

4 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 external user 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

5 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

6 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

7 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 MCS 270 Object-Oriented Software Development Example: Use-Case Description

8 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example: Use Case Diagram Graph showing Actors Use cases Edge: actor-case if that actor is involved in that case Actors Stick figures Use cases Ovals Repai r Ride passeng er technicia n MCS 270 Object-Oriented Software Development Boundary for all use cases

9 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Exceptional Situations Include relationships “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 MCS 270 Object-Oriented Software Development

10 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Repai r Ride passeng er technicia n Derail MCS 270 Object-Oriented Software Development > Buy Ticket >

11 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

12 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Interaction Modeling: Sequence Model MCS 270 Object-Oriented Software Development 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

13 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 MCS 270 Object-Oriented Software Development

14 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example Sequence Diagram Passeng er StationTrai n buyTicket() arrives openDoors() closeDoors() pushButton(S) Classes & Actors MCS 270 Object-Oriented Software Development

15 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example Sequence Diagram Passeng er StationTrai n buyTicket() arrives openDoors() closeDoors() Method Call Note: These are all synchronous method calls. There are other kinds of invocations. MCS 270 Object-Oriented Software Development pushButton(S)

16 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example Sequence Diagram Passeng er StationTrai n buyTicket() arrives openDoors() closeDoors() Invocation lifetime spans lifetimes of all nested invocations MCS 270 Object-Oriented Software Development pushButton(S)

17 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example Sequence Diagram Passeng er StationTrai n buyTicket() arrives openDoors() closeDoors() “Lifelines” fill in time between invocations pushButton(S)

18 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Interaction Modeling: Activity Model MCS 270 Object-Oriented Software Development Activity Model consists of: Activity Diagram: Flow Chart of operations of application

19 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example Activity Diagram buyTicket trainArrive board Activities in roundtangl es StationTrain MCS 270 Object-Oriented Software Development

20 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu buyTicket trainArrive board Fork StationTrain MCS 270 Object-Oriented Software Development Example Activity Diagram Join Concurren cy

21 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu buyTicket trainArrive board Swim lanes show which classes/actors are responsible for which part of the diagram StationTrain MCS 270 Object-Oriented Software Development Example Activity Diagram

22 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu stopTrain announceNoStop StopRequested? yesno Flow-chart if- then MCS 270 Object-Oriented Software Development Example Activity Diagram

23 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

24 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 Overview on Using UML: What ’ s Not so Good

25 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

26 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

27 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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

28 GUSTAVUS ADOLPHUS COLLEGEgustavus.edu 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 MCS 270 Object-Oriented Software Development


Download ppt "MCS 270 Spring 2014 Object-Oriented Software Development."

Similar presentations


Ads by Google