Dice Game Case Study 11 30 6

4 251 vues

Publié le

Object-oriented analysis and design(OOAD) UML Slides. for more slides refer www.scmGalaxy.com.

0 commentaire
0 j’aime
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Aucun téléchargement
Nombre de vues
4 251
Sur SlideShare
Issues des intégrations
Intégrations 0
Aucune incorporation

Aucune remarque pour cette diapositive

Dice Game Case Study 11 30 6

  1. 1. An Example of Object – Oriented Analysis and Design “A Dice Game” <ul><ul><ul><li>Play Rules / Business Rules: </li></ul></ul></ul><ul><ul><ul><li>A “dice game” in which a player rolls two dice. </li></ul></ul></ul><ul><ul><ul><li>If the total is seven, they win; otherwise, they lose . </li></ul></ul></ul>The dice game is very simple problem, presented in order to focus on some of the steps and artifacts in object – oriented analysis and design rather than on the problem domain.
  2. 2. Most essential and commonly used steps in OOAD Define use cases Define conceptual model Define collaboration diagrams Define design class diagrams System Behavior diagram Analysis Design
  3. 3. Define use cases <ul><li>Understanding the requirements includes, in part, understanding the </li></ul><ul><li>domain processes and the external environment – external actors who </li></ul><ul><li>participate in processes. </li></ul><ul><li>These domain processes can be expressed in use cases – </li></ul><ul><li>narrative descriptions of domain processes in a structured text format </li></ul><ul><li>For example , in the dice game, here is the Play Game High level </li></ul><ul><li>usecase </li></ul><ul><ul><ul><li>Use case : Play a Game </li></ul></ul></ul><ul><ul><ul><li>Actors : Player </li></ul></ul></ul><ul><ul><ul><li>Description : This use case begins when then </li></ul></ul></ul><ul><ul><ul><li>the player picks up and rolls the </li></ul></ul></ul><ul><ul><ul><li>dice. If the dice total seven, they </li></ul></ul></ul><ul><ul><ul><li>win; other wise, they lose </li></ul></ul></ul>
  4. 4. Expanded Usecase: Alternate path to 2a : the total is 7 then the player looses the game SI No Actors Action SI No System Response 1 This use case begins when the Player starts the game by picking up the dice and then player rolls the the dice 2       2a Die Game will collect face value of each dice and then adds up to give the sum of the face value( total ) for a particular roll.   If the dice total is 7 then system will indicate the player that he win’s , and request the player to continue the game.
  5. 5. Usecase Diagram
  6. 6. <ul><li>A decomposition of the problem domain involves an identification of </li></ul><ul><ul><ul><ul><li>concepts </li></ul></ul></ul></ul><ul><ul><ul><ul><li>attributes </li></ul></ul></ul></ul><ul><ul><ul><ul><li>associations </li></ul></ul></ul></ul><ul><li>in the domain that are considered important. </li></ul><ul><li>The result can be expressed in a conceptual model, which is </li></ul><ul><li>illustrated in a set of diagrams that depict concepts (objects). </li></ul>Define conceptual model
  7. 7. Conceptual model of the Dice game The conceptual model is not a description of software components; it represents concepts in the real – world problem domain .
  8. 8. Defining Collaboration Diagrams <ul><li>Collaboration diagrams show the flow of messages between instances and the invocation of methods </li></ul><ul><li>Object - oriented design is concerned with defining logical software specifications that fulfill the functional requirements based on decomposition by classes of objects. </li></ul><ul><li>An essential step in this phase is the allocation of responsibilities to objects and illustration how they interact via messages, expressed in collaboration diagrams . </li></ul>
  9. 9. Defining Collaboration Diagrams Illustrating messages between software objects For example, assume that a simulation in software of the dice game is desired. This collaboration diagram in Figure illustrates the essential step of playing by sending messages to instances of the Player and die classes.
  10. 10. Defining Design Class Diagrams <ul><li>“ These illustrate class definitions that are to be implemented </li></ul><ul><li>in software” </li></ul><ul><li>In order to define a class, several questions must be answered </li></ul><ul><ul><li>How do objects connect to other objects? </li></ul></ul><ul><ul><li>What are the methods of a class? </li></ul></ul><ul><li>To answer these questions, inspect the collaboration diagrams, which suggests the necessary connections between objects, and the methods that each software class must define </li></ul>
  11. 11. Design class diagram of software components . For example, in the dice game, an inspection of the collaboration diagram leads to the following design class diagram. In contrast to the conceptual model, this diagram does not illustrate real – world concepts; it describes software components
  12. 12. Design class diagram of software components........ <ul><li>Since a play message is sent to a Player instance, Player requires a play method, while Die requires a roll method. </li></ul><ul><li>To illustrate how objects connect to each other via attributes, a line with an arrow at the end may suggest an attribute. </li></ul><ul><li>For example, Dice Game has an attribute that points to an instance of a Player.(visibility issues) </li></ul>