1 / 8

SEQUENCE DIAGRAM EXAMPLE

Buys. quantity. SEQUENCE DIAGRAM EXAMPLE.

Télécharger la présentation

SEQUENCE DIAGRAM EXAMPLE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Buys quantity SEQUENCE DIAGRAM EXAMPLE Part of the information kept in the RentalCopy class in the domain model shown below is the rental status of a video. Construct a state machine diagram showing the states that an instance of the RentalCopyclass can be in with respect to its rental status. Show only the states, transitions and the events and/or conditions, if any, that cause a transition to be taken. Do not show the activities that can occur within a state. Has 1 0..* 0..5 * MovieVideo RentalCopy 1 * * IsFor CurrentRental RentalHistory Reserves 1 * * Provides * 1 Review Customer * Member 0..1

  2. STATE MACHINE DIAGRAM EXAMPLE The problem statement requirements that are relevant to determining the states of a RentalCopy object: – The system must be able to keep track of which movie videos have been bought/rented and by whom. For videos bought, the system must record the quantity bought; for videos rented, the system must record which copy of the video has been rented and when it is due back. – The system must keep track of overdue rental videos and allow notices to be sent to customers who have videos overdue. – Members should be able to make reservations for movie video rentals either in person at the store, by telephone or via the Web. – A member can reserve at most five movie videos at any one time, but there is no limit on how many movie videos a member or nonmember can rent at any one time. – Staff must be able to sell/rent videos from the store􀀁s inventory and return rented videos to the store's inventory.

  3. STATE MACHINE DIAGRAM EXAMPLE:ANALYSIS – The system must be able to keep track of which movie videos have been bought/rented and by whom. For videos bought, the system must record the quantity bought; for videos rented, the system must record which copy of the video has been rented and when it is due back. states:Available; Rented events: rent transitions:Available rent Rented – The system must keep track of overdue rental videos and allow notices to be sent to customers who have videos overdue. states:Overdue events:when(date>returnDate) transitions:Rented when(date>returnDate) Overdue – Members should be able to make reservations for movie video rentals either in person at the store, by telephone or via the Web. states:Reserved events:reserve transitions:Available  reserve Reserved Reserved  rent Rented

  4. STATE MACHIINE DIIAGRAM EXAMPLE:ANALYSIS – A member can reserve at most five movie videos at any one time, but there is no limit on how many movie videos a member or nonmember can rent at any one time. No state, event or transition information in this statement. – Staff must be able to sell/rent videos from the store􀀁s inventory and return rented videos to the store's inventory. event:return transitions:Rented  return  Available Overdue return Available Other reasonable events and transitions events:cancel, delete transitions:Reserved cancel Available Available  delete  Final state

  5. STATE MACHIINE DIIAGRAM EXAMPLE:SOLUTION

  6. STATE MACHIINE DIIAGRAM EXAMPLE:SOLUTION We can also create a composite state Unavailable.

  7. STATE MACHINE DIAGRAM :COMMON ERRORS • Showing flow of control. (A state machine is not a flow chart!) see Activity Diagrams. • Showing states/transitions/events not applicable to the object under consideration. e.g., reservedCopy < 5applies to Member objects,not RentalCopy objects • Mixing up states and events. e.g., return is not a state • Having transitions with no events. • Having transitions with several events.

  8. STATE MACHINE DIAGRAM :COMMON ERRORS • Using attributes not in the object. e.g., #copies • Having states with no outgoing transition. e.g., Overdue, Reserved • Using states not in the problem description. e.g., stolen, sold, lost

More Related