没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
311页
The intent of this book is to help the beginning designer by giving them a sequence of interesting and moderately complex exercises in OO design. This book can also help managers develop a level of comfort with the process of OO software development. The applications we will build are a step above trivial, and will require some careful thought and design. Further, because the applications are largely recreational in nature, they are interesting and engaging. This book allows the reader to explore the processes and artifacts of OO design before project deadlines make good design seem impossible
资源推荐
资源详情
资源评论
Building Skills in Object-Oriented Design
Release 2.1.1-Java
Steven F. Lott
December 30, 2009
CONTENTS
I Front Matter 3
1 Preface 5
1.1 Why Read This Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Organization of This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Why This Subject? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5 Programming Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Conventions Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.7 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 Foundations 13
2.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Our Simulation Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3 Soapbox on Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 Solution Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Methodology, Technique and Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
II Roulette 25
3 Roulette Details 29
3.1 Roulette Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Available Bets in Roulette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3 Some Betting Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4 Roulette Solution Overview 35
4.1 Preliminary Survey of Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.2 Preliminary Roulette Class Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.3 A Walkthrough of Roulette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.4 Roulette Solution Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5 Outcome Class 41
5.1 Outcome Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2 Design Decision – Object Identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.3 Outcome Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.4 Outcome Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.5 Message Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6 Bin Class 47
i
6.1 Bin Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2 Design Decision – Choosing A Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.3 Bin Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.4 Bin Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.5 Bin Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7 Wheel Class 53
7.1 Wheel Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.2 Wheel Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
7.3 Non-Random Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.4 Wheel Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8 Bin Builder Class 57
8.1 Bin Builder Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
8.2 Bin Builder Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
8.3 BinBuilder Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.4 Bin Builder Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.5 Internationalization and Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
9 Roulette Bet Class 63
9.1 Roulette Bet Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
9.2 Design Decision – Create or Locate an Outcome . . . . . . . . . . . . . . . . . . . . . . . . . 63
9.3 Design Decision – Where to Keep the Outcome Map . . . . . . . . . . . . . . . . . . . . . . . 64
9.4 Roulette Bet Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
9.5 Roulette Bet Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9.6 Roulette Bet Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
10 Roulette Table Class 69
10.1 Roulette Table Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
10.2 InvalidBet Exception Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.3 Roulette Table Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
10.4 Roulette Table Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
11 Roulette Game Class 73
11.1 Roulette Game Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
11.2 Passenger57 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
11.3 Roulette Game Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
11.4 Roulette Game Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
11.5 Roulette Game Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
11.6 Additional Roulette Design Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
12 Review of Testability 79
12.1 Testability Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
12.2 Test-Driven Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
12.3 Capturing Pseudo-Radom Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
12.4 Testability Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
12.5 Testable Random Events Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
12.6 Testability Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
13 Player Class 85
13.1 Roulette Player Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
13.2 Player Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
13.3 Martingale Player Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
13.4 Player Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
ii
14 Overall Simulation Control 91
14.1 Simulation Control Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
14.2 Simulation Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
14.3 Simulator Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
14.4 Player Rework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
14.5 Simulation Control Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
15 SevenReds Player Class 97
15.1 SevenReds Player Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.2 SevenReds Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
15.3 Player Rework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
15.4 Game Rework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
15.5 SevenReds Player Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
16 Statistical Measures 101
16.1 Statistics Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
16.2 Some Foundations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
16.3 Statistical Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
16.4 IntegerStatistics Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
16.5 Statistics Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
17 Random Player Class 107
17.1 Random Player Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
17.2 Random Player Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
17.3 Random Player Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
18 Player 1-3-2-6 Class 109
18.1 Player 1-3-2-6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
18.2 On Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
18.3 Player 1-3-2-6 Questions and Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
18.4 Player1326 State Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
18.5 Player1326 No Wins Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
18.6 Player1326 One Win Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
18.7 Player1326 Two Wins Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
18.8 Player1326 Three Wins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
18.9 Player1326 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
18.10 Player 1-3-2-6 Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
18.11 Advanced Exercise – Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
18.12 Advanced Exercise – Less Object Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
19 Cancellation Player Class 117
19.1 Cancellation Player Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
19.2 PlayerCancellation Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
19.3 Cancellation Player Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
20 Fibonacci Player Class 119
20.1 Fibonacci Player Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
20.2 PlayerFibonacci Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
20.3 Fibonacci Player Deliverables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
21 Conclusion 123
iii
剩余310页未读,继续阅读
资源评论
yonglec
- 粉丝: 1
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功