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

  • Webservice design and model 2009-04-21

    In this paper, are chapter asked (at the original DevX ), For preliminary want to know webservice friend may help. Webservice as a new technology appears in front of us, it's birth are used to address different applications platform synergy. At prese

  • 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

  • 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

  • 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

  • Strategy design pattern model (Strategy Pattern) 2010-07-18

    Strategy design pattern model (strategy-pattern) For a long time to buy the book head first design patterns, and entangled for a long time, finally a shot of the day. Has been found to work for some time drift, and to increase knowledge, and I want t

  • Java reflection of: access to an array of the type of object components 2010-12-24

    public class Main { public static void main(String[] argv) { System.out.println(new int[1][2][3].getClass().getComponentType()); } }

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

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

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

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