1 / 11

Objectives

CS 190M Introduction to Programming with Concurrency Lecture: 4. September 8, 2008 Class and Sequence Diagrams Aditya Mathur. Objectives. Learn about: Incremental development Modifying a design to include new requirements. Reading: Textbook: Chapter 5.1, 5.2, 5.3.

powa
Download Presentation

Objectives

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. CS 190M Introduction to Programming with ConcurrencyLecture: 4. September 8, 2008Class and Sequence DiagramsAditya Mathur CS 190M. Lecture 4.

  2. Objectives • Learn about: • Incremental development • Modifying a design to include new requirements Reading: Textbook: Chapter 5.1, 5.2, 5.3 CS 190M. Lecture 4.

  3. Recall: First increment: RobotFunOne • Simulate the movement of a single robot. • The robot accepts the following move commands: • S(traight) • B(ackwards) • L(eft) • R(ight) • Use the E(xit) command to exit from the simulato • Additional commands: • F: Sound OFF • N: Sound ON CS 190M. Lecture 4.

  4. Second increment: RobotFunTwo • Simulate the movement of a single robot. • Ensure that it does not collide with the surrounding walls • Robot is initially placed in a square room. Q: Which parts of the design/code need modification? CS 190M. Lecture 4.

  5. attributes Robot RobotFunOne positionX: int positionY: int name: String <<create>> moveRobot getCommand main <<call>> operations Robot getPosX getPosY move <<call>> RobotSounds playClip Recall: Classes in RobotFunOne A class diagram helps (a) enumerate classes used in your program and (b) specify how these classes relate to each other. CS 190M. Lecture 4.

  6. attributes Robot RobotFunTwo positionX: int positionY: int name: String <<create>> moveRobot getCommand main <<call>> operations Robot getPosX getPosY move collision <<call>> RobotSounds playClip Classes in RobotFunTwo Recall: A class diagram helps (a) enumerate classes used in your program and (b) specify how these classes relate to each other. CS 190M. Lecture 4.

  7. aRobot: Robot :RobotFunOne Create a robot start aRobot getCommand loop move Generate sound getCommand :RobotSounds Display goodbye Message and exit Recall: Behavior of RobotFunOne [command!=‘E’] CS 190M. Lecture 4.

  8. aRobot: Robot :RobotFunTwo Create a robot start aRobot getCommand [Collision not possible?] loop alt move Generate sound getCommand :RobotSounds Display goodbye Message and exit Behavior of RobotFunTwo [command!=‘E’] CS 190M. Lecture 4.

  9. Third increment: RobotFunThree • Simulate the movement of a single robot. • Ensure that it does not collide with the surrounding walls • Robot is initially placed in a square room. • Robot can move along any direction--specified by an angle in degrees. • Robot can move in multiple integral steps. • Commands: • M angle steps (e.g. M 45 3 to move three steps along 45 degrees) • E: Exit Q: Which parts of the design/code need modification? CS 190M. Lecture 4.

  10. RobotFunThree Robot command: char angle: double steps: int positionX: int positionY: int name: String <<create>> moveRobot getCommand main <<call>> Robot getPosX getPosY move collision V Generalization <<call>> AdvancedRobot RobotSounds advancedRobot move collision playClip Classes in RobotFunThree CS 190M. Lecture 4.

  11. king: AdvancedRobot :RobotFunThree Create a robot start king getCommand Collision not possible? loop alt move (angle, steps) Generate sound getCommand :RobotSounds Display goodbye Message and exit Behavior of RobotFunTwo command!=‘E’ CS 190M. Lecture 4.

More Related