Object-Oriented Analysis and Design - A simple dice game simulation to achieve (a)

Object-Oriented Analysis and Design

Since school is finally ushered in the real software engineers core courses: OOAD, Object-Oriented Analysis and Design. Teacher's always professional, I also listen to the whole day. In the classroom, teachers use a throwing dice game introduced the concept of object-oriented analysis, and lead us to the case analyzed. After class, I get enough, so when the class teacher in accordance with the method of analysis and design, and implement the basic functionality with java. Analysis and code will now be attached, after packing the jar in the annex for all to download, hope master wing.

For this case we are generally governed by the following steps:

1, define use cases

2, a domain model

3, build interactive map

4, development and design class diagram

Now start the analysis:

First, consider this description of the problem: This is a dice game, a throw two dice, two dice if the sum of 7 points is determined to win, otherwise lose.

In this case (case) where a total number of objects (which can be understood as an entity)?

Obviously, there are two: the dice, gambler.

So we can begin to define the Use Case (use cases).

So, in the end what is the Use Case it? In the UML documentation, Use Case is defined as: not to show the internal structure of a system or subsystem in the case of a coherent system or subsystem of the functional unit definition and description. It means the system functions (part of) the description. Of course, this function must be logically complete. Such as eating, sleeping, and so it is clear do what.

In this case, only one use case dice (to play the game). Can be described as follows:

Use Case: Play a Dice Game

• Primary Actor: Player

• Description: The player picks up and rolls the dice. If the dice total seven, they win, otherwise they lose.

General description of use cases in addition to text outside the best with a dapper figure, which uses UML to describe the map, so regardless of whether the industry background will be clear to see. The use case diagram, as follows:

Object-Oriented Analysis and Design - A simple dice game simulation to achieve (a)

Next we create a domain model

We break down the problem to determine things and concepts, and their attributes and relationships. Been a problem domain model. We get the following diagram:
Object-Oriented Analysis and Design - A simple dice game simulation to achieve (a)

The third step, we adopted the analysis of the object graph to be the interaction between object model, then you can get map messaging between objects (communication diagram).
Object-Oriented Analysis and Design - A simple dice game simulation to achieve (a)

Another interactive map is the sequence diagram, it shows the message passing between these objects to get the sequence of events as follows:

Object-Oriented Analysis and Design - A simple dice game simulation to achieve (a)

These two figure generally referred to as interaction diagrams (interaction diagrams).

Through the above analysis, and finally, we can get a software architecture model classes model the detailed structure of the solution. As shown below, no doubt, the rest into coding it!

Now a full UML modeling process is complete, because I am also a beginner, so in addition to the first picture is I use JUDE-COMMUNITY painting, other teachers were taken from the courseware. UML's friends want to give me guidance or expert.

分类:Development 时间:2010-11-27 人气:103
blog comments powered by Disqus


  • ajax using dwr tools to pass the value from the front page to back Java objects inside, and then according to the results of the object to return to the page up (back Qinbo personal summary) 2010-03-18

    ajax using dwr tools, from the front page the value passed to the Java objects back inside, then according to the results of the object to return to the page up (back Qinbo personal summary) Edit Article Categories: Web front-end 1.java class public

  • Introduction Compact design - the construction of error-free software 2009-08-26

    Thanks to the translator's hard to pay, but also thanks to the wisdom of sharing original author. Reprinted from Mr: http://softwarepractitioner.org/translations/meyer/contract.shtml ================================================== ================

  • Actual DDD (Domain-Driven Design Domain-Driven Design: Evans DDD) 2009-09-11

    And the field of object-oriented modeling Azeri Panchiao http://www.jdon.com 2006/12/6 (reprint requests to retain) If there is no changing needs, perhaps there would be no today's object-oriented software, we have tried, through demand management, d

  • Design and model Webservice 2009-09-28

    This is the chapter President (in the original devx ), A preliminary understanding for the webservice like there may be some help of friends. Webservice as a new technology appears in front of us, it is used to solve the birth of the platform in diff

  • Domain model-driven design (DDD) refining the model 2011-01-14

    When the Java world, the framework provided by the optional platform rises, we may be deeply troubled by the platform architecture, and to attend to the very core of the software: business modeling, in fact, business domain modeling framework is also

  • Combat DDD (Domain-Driven Design Domain Driven Design) 2011-01-14

    In 2004 the famous modeling expert Eric Evans published his famous books, the most influential: Domain-Driven Design-Tackling Complexity in the Heart of Software (Chinese translation: domain driven design in March 2006 Tsinghua University Press trans

  • Memorandum of Reading Notes design pattern model (Memento) 2010-10-18

    Memorandum mode: Without violating encapsulation premise of the object's internal state capture and save, so the object can be restored after the return to the saved state. Memorandum of relatively simple models, not because of unfamiliar names and c

  • -------- Flyweight design pattern model 2010-11-15

    Flyweight Is the boxing match special use terms, which means " Special lightweight ", referring to the 51 Kg class competition, design patterns used in the class is that we have to Lightweight , This is the smaller size to the table to the meani

  • Design B / S mode instant messaging software 2010-12-20

    1. Introduction At present, the instant messaging market has grown from an era of competition to monopoly rule over time. Most IM software has over time gradually withdraw from the competition arena. Instant messaging user base is gradually increasin

  • Architecture design anemia model granularity 2010-06-26

    Anemia model is the model only getset method, only the property does not conduct. In this framework, we write the class, methods are often too large, often face To the process of thinking. action ---> service -----> dao, domain model construction an

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.670 (s). 12 q(s)