1 / 16

Object-oriented Analysis and Design

Object-oriented Analysis and Design. Phases of the Project. Requirements Document. Object Model Diagram. State Transition Diagrams. Component Construction. Requirements Document.

berg
Télécharger la présentation

Object-oriented Analysis and Design

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. Object-oriented Analysis and Design Phases of the Project Requirements Document Object Model Diagram State Transition Diagrams Component Construction

  2. Requirements Document The Corey sisters have a privately-owned alley with a closed spar or turning lane at one end. The sisters plan to use this alley as a parking lot. The lot will hold a maximum of five cars in single file. Cars arrive at one end of the alley, enter at the back, and leave from the front. The spar is used to temporarily hold cars from the front of the line when a car from the middle or end of the line is set to leave. The capacity of the spar is one car less than the capacity of the lot. When the departing car has left, cars from the spar are moved back to the lot and placed in their previous position. All cars that were behind the departed car are moved up one position to allow room for new entries. When the lot is full newly arriving cars will have to find parking elsewhere. A lot simulation will exhibit the working of this lot with cars writing messages showing the times in which they enter and leave the lot or when they arrive and find the lot full.

  3. Requirements Document The Corey sistershave a privately-owned alley with a closed spar or turninglane at one end. The sistersplan to use this alley as a parkinglot. The lotwill hold a maximum of five cars in single file. Carsarrive at one end of the alley, enterat the back, and leave from the front. The sparis usedto temporarily holdcars from the front of the line when a car from the middle or end of the line is set to leave. The capacityof thesparis one car less than the capacityof thelot. When the departing car has left, carsfrom thesparare moved back to the lot and placed in their previousposition. All cars that were behind the departed car are movedupone position to allow room for new entries. When the lotis full newly arriving carswill have to find parking elsewhere. A lotsimulationwillexhibit the working of this lot with carswritingmessages showing the times in which they enter and leave the lot or when they arrive and find the lot full.

  4. Nouns (or noun phrases Sisters (irrelevant) Lot (same as alley and parking lot) Car End, back, front, position (attributes of Lot) Spar Capacity (attribute of Lot and Spar) LotSimulation (to be called LotSim) Message (can be implemented as a string) Arrive/depart time (attributes of car)

  5. Object (Class) Interaction Subject Verb Phrase Object Lot will hold (max of 5) Cars Cars enter (back of) Lot Cars leave (front of) Lot Lot uses Spar Spar holdsCars LotSim exhibits (working of) Lot Cars write Messages

  6. Diagram of the Parking Lot Entry Road Lot Spar Exit Road

  7. Object Model Diagram generates LotSim shows uses holds Lot Spar Car enter leave holds

  8. Design Phase – Refine Object Model LotSim generates Car list enter(Car) leave(Car) Lot Car double arrTime double depTime String name Car list int capacity

  9. Design Phase – State Transition Diagrams enter enter enter enter enter enter start 5 0 1 3 4 2 leave leave leave leave leave isFull == TRUE * States of Lot objects – maxCars = 5 * IsFull tested on each state

  10. Class Lot Lot Car list int capacity enter (Car c) leave(Car c) boolean isFull( ) Lot ( ) Messages received from LotSim

  11. Design Phase – State Transition Diagrams parked leave park newCar String name double arrTime double depTime discarded Start balk State Diagram for Car Objects

  12. Class Car Car double arrTime double depTime String name car(String, double, double) park ( ) leave( ) balk( ) Methods park, leave, and balk invoked from Lot objects -- messages displayed on monitor

  13. Design Phase – State Transition Diagrams push push start 0 1 lot_size - 1 pop pop push isEmpty ==TRUE error State Transitions of Spar Objects

  14. Design Phase – Refine Object Model push(Car) pop( ) Spar push(Car) Lot Car List attributes pop( ) methods IsEmpty( )

  15. Design Phase – Refine Object Model Class Spar is_a Stack class Spar extends Stack { private static final int sparSize = 4; public void push (Car myCar) { if (size ( ) < sparSize) { super.push(); } }

  16. Object-oriented Analysis and Design Source code for Parking Lot simulation classes Car.javaclass Car, Lot.javaclass Lot Deck.java class Deck, LotSim.java Application class Source code for PriorityQ and EventDriver classes PriorityQ.java A data structure for holding event notices EventDriver.java An application that generates and processes events

More Related