Presentation is loading. Please wait.

Presentation is loading. Please wait.

Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence.

Similar presentations


Presentation on theme: "Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence."— Presentation transcript:

1 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence diagrams Identifying objects

2 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 2 Reminder! Analysis: deciding what to do –use cases, diagrams, UML, … Design: finding out how to do –language, algorithms, database, …

3 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 3 Use case Description of an interaction that achieves a useful goal to the user Actor: external entity that interacts with the system System: application and hardware that users will use

4 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 4 Actors One actor for each role Have responsabilities: –Initiate actions –Receive instructions Use case diagram: Bank clerk Open account database

5 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 5 Use case diagram Draw the use case diagram for the following description to control a door: The customer arrives at the door. A sensor is activated and the door opens. After 3 seconds it closes, provided that the sensor is not detecting any customer. What are the actors? What if the shop system need the time the door closes and opens?

6 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 6 Use cases A collection of uses cases provide information about the system: –Actors and details about their interaction with the system –Relationships with other use cases –Pre- and post- conditions –Exceptions: things that might go wrong and need action –Constraints (or restrictions) –Alternatives

7 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 7 System sequence diagrams What is the dynamics of the system? The answer can be sequence diagrams. They allow us to: –Identify system events –Create sequence of events for use case scenarios –Show input and output events

8 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 8 Use cases Example: how does a supermarket sells items? The customers enter the supermarket and choose the items by themselves. Then they to the checkout with items to purchase. The cashier registers each purchased item. The system presents the total amount to be paid and a list with the items. The customer enters payment information, which the system validates and records. The system updates inventory. The customer receives a receipt from the system and then leaves with the items.

9 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 9 Sequence of events What is one possible flow of events for this example? 1. Customer arrives at the checkout with goods to purchase. 2. Cashier starts a new sale. 3. Cashier enters item identifier (bar code,…) 4. What happens in this step? 5. System presents total with taxes calculated. 6. Cashier tells Customer the total, and asks for payment. 7. Customer pays and System handles payment. 8. The system logs the transaction 9. The system releases the receipt 10. The customer leaves with goods and receipt

10 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 10 Alternative Flows How is the payment handled? 7.1: Paying by cash 1. Cashier enters the cash amount tendered. 2. System presents the balance due, and releases the cash drawer. 3. Cashier deposits cash handed and returns balance in cash to Customer. 4. System records the cash payment. 7.2: Paying by credit card … 7.3: Paying with some coupon …

11 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 11 Sequence diagrams Show actors and input and output events to the systems and in which order Systems are treated as black boxes Emphasis on the events that cross the system boundary from the actors

12 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 12 What’s in a name? Names for events: focus on what, rather than how What is the event: the cashier enters an item - enterItem(id,qt) How is the event realized: –typing on the keyboard –scanning the bar code –RFID tags –…

13 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 13 Sequence diagrams Draw the sequence diagram: 1.For the control door example 2.For the cashier example 3.Identify the nouns and verbs in the use cases.

14 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 14 Finding the objects and classes Look also in similar systems in books, reports, with friends, … In the use cases: –Nouns are candidates for objects, classes, interfaces –Verbs are candidats for services Later you can find that some of the objects may be: –Not needed in the system –Just attibutes to some class –A class

15 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 15 Objects and abstractions An abstraction of a fire truck is not a fire truck: several details are left out. But still: –Provides services: turn siren on/off, turn left/right, raise stairs, … –Has exception conditions: battery drained, broken stairs, … –Has attibutes Variable: battery level, new/old, … Constant: colour, height, …

16 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 16 Finding responsibilities What is the purpose of the object? We need to identify: Attibutes Services Methods

17 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 17 Identifying attributes What is the general description of the object? What parts of the general description that are applicable to the domain? What is the minimal description?

18 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 18 Is it a class or an attribute? General rule: it is an attribute if it is a name or a number, and class otherwise Example: a flight is from one city to another and has a number and date/time of departure

19 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 19 Is it a class or an attribute? Can you suggest other ways to do it? Which one is the right one? or What kind of relationship is this?

20 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 20 Is it a class or an attribute? Value X independent existence Example: an address can be just a string or be manipulated as an independent entity, as in finding the best route in a delivery system. or

21 Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 21 Identifying services Simple services (standard to all objcts) –Creation and initialization of objects –Connections between objects –Getting and setting attributes values –Disconnections from other objects –Deleting objects Complex services


Download ppt "Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence."

Similar presentations


Ads by Google