敏捷软件开发:原则、模式与实践(英文注释版)

敏捷软件开发:原则、模式与实践(英文注释版)
作 者: Robert C.Martin
出版社: 人民邮电出版社
丛编项: 图灵原版计算机科学系列
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: 软件项目管理
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  Robert C.Martin(“Bob大叔”)世界级的软件开发大师,著名软件咨询公司Object Mento,公司的创始人和总裁。曾经担任C++Report杂志主编多年,也是设计模式和敏捷开发运动的主要倡导者之一。

内容简介

本书中,享誉全球的软件开发专家和软件工程大师Robert C. Martin深入而生动地使用真实案例讲解了面向对象基本原则、重要的设计模式、UML和敏捷实践等程序员必备的知识。 本书于2003年荣获第13届Jolt大奖,是C++和Java程序员提高自身水平的绝佳教材,也适于用作高校计算机、软件工程专业相关课程的教材或参考书。

图书目录

Section 1 Agile Development敏捷开发 1

Chaper1 Agile Practices敏捷实践 3

The Agile Alliance敏捷联盟 4

The Manifesto of the Agile Alliance敏捷联盟宣言 4

Principles敏捷原则 6

Conclusion结论 8

Bibliography参考文献 9

Chaper2 Overview of Extreme Programming极限编程概述 11

The Practices ofExtreme Programming极限编程的实践 11

Customer Team Member客户团队成员 11

User Stories用户故事 12

Short Cycles短交付周期 12

Acceptance Tests验收测试 13

Pair Programming结队编程 13

Test Driven Development测试驱动开发 14

Collective Ownership集体昕有权 14

Continuous Integration持续集成 14

Sustainable Pace可持续的开发速度 15

Open Workspace开放工作空间 15

The Planning Game计划游戏 15

Simple Design简单设计 15

Refactoring重构 16

Metaphor隐喻 16

Conclusion结论 17

Bibliography参考文献 17

Chapter3 Planning计划 19

Initial Exploration初始探索 20

Spiking,Splitting,and Velocity探究、分解和速度 20

Release Planning发布计划 20

Iteration Planning迭代计划 21

Task Planning任务计划 21

The Halfway Point迭代中点 22

Iterating迭代 22

Conclusion结论 22

Bibliography参考文献 22

Chapter4 Testing测试 23

Test Driven Development测试驱动开发 23

An Example of Test-First Design测试优先设计的例子 24

Test Isolation测试促进隔离 25

Serendipitous Decoupling意外获得的解耦合 26

Acceptance Tests验收测试 27

Example of Acceptance Testing验收测试示例 27

Serendipitous Architecture意外获得的架构 29

Conclusion 结论 29

Bibliography参考文献 29

Chapter5 Refactoring重构 31

Generating Primes:A Simple Example of Refactoring素数产生程序:一个简单的重构示例 32

The Final Reread最后审视 38

Conclusion结论42

Bibliography参考文献 42

Chapter6 A Programming Episode一次编程实践43

The Bowling Game保龄球比赛 44

Conclusion结论 82

Section 2 Agile Design敏捷设计 85

Symptoms of Poor Design糟糕设计的症状 85

Principles原则 86

Smells and Principles坏味与原则 86

Bibliography参考文献 86

Chapter 7 What Is Agile Design?什么是敏捷设计 87

What Goes Wrong with Software?软件哪里出问题了 87

Design Smells--The Odors of Rotting Software设计坏味--腐化软件的气味 88

What Stimulates the Software to Rot?软件为何腐化 89

Agile Teams Don’t Allow the Software to Rot敏捷团队不允许软件腐化 90

The“Copy”Program copy程序 90

Agi-l:Desig-n of the c。py Example copy~序的敏捷设计 93

How Did the Agile Developers Know what to Do?敏捷开发人员怎样做 94

Keeping the Design As Good As It Can Be尽量保持设计简洁 94

Conclusion结论 94

Bibliography参考文献 94

Chapter 8 SRP:The Single-Responsibility Principle SRP:单一职责原则 95

A CLASS SIIOUI HAVE 0NLY 0NE REASON TO CHANGE.

SRP:The Single-Responsibility Principle SRP:单一职责原则 95

What Is a Responsibility?定义职责 97

Separating Coupled Responsibilities分离耦合的职责 97

Persistence持久化 98

Conclusion结论 98

Bibliography参考文献 98

Chapter 9 OCP:The Open-Closed Principle OCP:开放一封闭原则 99

SOFTWARE ENTITIES(CLASSES,MODULES,FUNCTI0NS,ETC.) SHOULD BE OPEN

FOR EXTENSION,BUT CLOSED FOR MODIFICATI0N.

OCP:The Open-Closed Principle OCP:开放封闭原则 99

Description概述 100

Abstraction Is the Key抽象是关键 100

The Shape Application Shape应用程序 l0l

Violating the OCP 违反OCP 101

Conforming to the OCP遵守OCP 103

OK,I Lied好吧,我说谎了 104

Anticipation and“Natural-Structure预测与“贴切的”结构 105

Putting the“Hooks-In放置“吊钩” 1 05

Using Abstraction to Gain Explicit Closure使用抽象获得显式封闭 106

Using a“Data-Driven”Approach to Achieve Closure使用“数据驱动”获得封闭 107

Conclusion结论 l08

Bibliography参考文献 109

Chapter 10 LSP:The Liskov Substitution Principle LSP:Liskov替换原则 111

SUBTYPES MUST BE SUBSTTUTABLE FOR THEIR BASE TYPES.

LSP:The Liskov Substitution Principle LSP:Liskov替换原则 111

A Simple Example of a Violation of the LSP违反LSP的简单例子 112

Square and Rectangle,a More Subtle Violation正方形和矩形,一个更微妙的违反情形 113

The Real Problem真正的问题所在 l15

Validity Is Not Intrinsic有效性并非本质属性 l16

ISA Is about Behavior ISA重在行为 l16

Design by Contract按契约设计 l17

Specifying Contracts in Unit Tests在单元测试中指定契约 117

A Real Example一个实例 l17

Motivation动机 118

Problem问题 119

A Solution That Does Not Conform to the LSP不遵守LSP的解决方案 l20

An LSP-Compliant Solution遵守LSP的解决方案 l20

Factoring Instead of Deriving用提取公共部分的方法代替继承 12l

Heuristics and Conventions启发式规则号惯用法 124

Degenerate Functions in Derivatives派生类中的退化函数 124

Throwing Exceptions from Derivatives从派生类抛出异常 124

Conclusion结论 l25

Bibliography参考文献 125

Chapter11 DIP:The Dependency-Inversion Principle DIP:依赖倒置原则 127

A.HIGH-LEVEL MODULES SHOULD NOT DEPEND UPON LOW-LEVEL MODULES.

BOTH SHOULD DEPEND ON ABSTRACTIONS.

B.ABSTRACTIONS SHOULD NOTDEPEND ONDETAILS.DETAILS SHOULD

DEPEND ON ABSTRACTIONS.

DIP:The Dependency-Inversion Principle DIP:依赖倒置原则 127

Layering层次化 128

An Inversion of Ownership倒置的接口所有权 128

Depend on Abstractions依赖于抽象 129

A Simple Example简单的DIP示例 130

Finding the Underlying Abstraction找出潜在的抽象 131

The Furnace Example熔炉示例 132

Dynamic V.Static Polymorphism动态多态与静态多态 133

Conclusion结论 134

Bibliography参考文献 134

Chapter 12 ISP:The Interface-Segregation Principle ISP:接口隔离原则 135

Interface Pollution接口污染 135

Separate Clients Mean Separate Interfaces分离客户就是分离接口 137

The Backwards Force Applied by Clients Upon Interfaces客户对接口的反作用力 137

CLIENTS SHOULD NOT BE FORCED TO DEPEND ON METHODS THAT THEY DO NOT USE.

ISP:The Interface-Segregation Principle ISP:接口隔离原则 137

Class Interfaces v.0bject Interfaces类接口与对象接口 138

Separation through Delegation使用委托分离接口 138

Separation through Multiple Inheritance使用多重继承分离接口 139

The ATM User Interface Example ATM用户界面的例子 139

The Polyad v.the Monad多参数与单参数 144

Conclusion结论 145

Bibliography参考文献 145

Section 3 The Payroll Case Study薪酬系统案例研究 147

Rudimentaxy Specification of the Payroll System薪酬系统的初步规格说明 148

Exercise练习 148

Use Case 1:Add New Employee用例1:增加新雇员 148

Use Case 2:Deleting an Employee用例2:删除雇员 149

Use Case 3:Post a Time Card用例3:登记考勤卡 149

Use Case 4:Posting a Sales Receipt用例4:登记销售凭条 149

Use Case 5:Posting a Union Service Charge用例5:登记工会会费 150

Use Case 6:Changing Employee Details用例6:更改雇员明细 150

Use Case 7:Run the Payroll for Today用例7:运行系统,今天付酬 150

Chapter13 COMMAND and ACTIVE 0BJECT COMMAND模式与ACTIVE OBJECT模式 151

Simple Commands简单的Command 152

Transactions事务 153

Physical and Temporal Decoupling实体上解耦和时间上解耦 154

Temporal Decoupling时间上解耦 154

UNDO undo()方法 154

ACTIVE 0BJECT ACTIVE OBJECT模式 155

Conclusion结论 l59

Bibliography参考文献 159

Chapter14 TEMPLATE METHOD&STRATEGY:Inheritance VS.Delegation

TEMPLATE METHOD模式~nSTRATEGY模式:继承和委托 161

TEMPLATE METHOD TEMPLATE METHOD模式 162

Pattern Abuse滥用模式 l64

Bubble Sort冒泡排序 l65

STRATEGY STRATEGY模式 168

Sorting Again再次排序 l70

Conclusion结论 l72

Bibliography参考文献 l72

Chaper15 FACADE and MEDIATOR FACADE模式和MEDlATOR模式 173

FACADE FACADE模式 173

MEDIATOR MEDIATOR模式 174

Conclusion结论 l76

Bibliography参考文献 l76

Chapter16 SINGLETON and MONOSTATE SINGLETON模式和MONOSTATE模式 177

SINGLETON sINGLEToN模式 178

Benefits of the SINGLETON SINGLETON模式的好处 179

Costs of the SINGLETON SINGLETON模式的代价 179

SINGLETON in Action运用SINGLETONN模式 179

MONOSTATE MONOSTATE模式 180

Benefits of MONOSTATE MONOSTATE模式的好处 l82

Costs of MONOSTATE MONOSTATE模式的代价 l82

MONOSTATE in Action运用MONOSTATE模式 l82

Conclusion结论 187

Bibliography参考文献 l87

Chapter 17 NUI.I。0BJECT NULL OBJECT模式 189

Conclusion结论 l92

Bibliography参考文献 192

Chapter 18 The Payroll Case Study:Iteration One Begins 薪酬系统案例研究:第一次迭代开始 193

Introduction引言 193

Specification规格说明 193

Analysis bv Use Cases基于用例分析 194

Adding Employees增加新雇员 195

Deleting Employees删除雇员 196

Posting Time Cards登记考勤卡 196

Posting Sales Receipts登记销售凭条 197

Posting a Union Service Charge登记工会会费 197

Changing Employee Details更改雇员明细 198

Payday发薪日 199

Reflection:What Have We Learned?反思:我们学到了什么 20 1

Finding the Underlying Abstractions找出底层的抽象 201

The Schedule Abstraction时间表抽象 201

Payment Methods支付方式 202

Affiliations从属关系 202

Conclusion结论 203

Bibliography参考文献 203

Chapter 19 The Payroll Case Study:Implementation薪酬系统案例研究:实现 205

Adding Employees增加雇员 206

The Payroll Database薪酬系统数据库 207

Using TEMPLATE METHOD to Add Employees使用TEMPLATE MEn{OD模式增加雇员209

Deleting Employees删除雇员 212

Global Variables全局变量 213

Time Cards,Sales Receipts,and Service Charges考勤卡、销售凭条和会费 214

Changing Employees更改雇员属性 220

Changing Classification更改雇员类别 224

What Was I Smoking?一点意外 229

Paying Employees支付雇员薪水 233

Do We Want Developers Making Business Decisions?我们希望开发员做业务决策吗235

Paying S alaried Employees支付领月薪的雇员薪水 235

Paying Hourly Employees支付钟点工薪水 237

Pay Periods:A Design Problem支付期限:设计问题 241

Main Program主程序 248

The Database数据库 248

Summary of Payroll Design薪酬系统案例设计总结 249

History历史 249

Resources资源 250

Bibliography参考文献 250

Section 4 Packaging the Payroll System打包薪酬系统 251

Chapter 20 Principles of Package Design包设计原则 253

Designing with Packages?使用包进行设计 253

Granularity:The Principles of Package Cohesion包的内聚性原则:粒度 254

The Reuse-Release Equivalence Principle(REP)重用发布等价原则 254

THE GRANULE OF REUSE IS THE GRANULE OF RELEASE.

The Common-Reuse Principle(CRP)共同重用原则 255

THE CLASSES IN A PACKAGE ARE REUSED TOGETHER.IF YOU REUSEONE OF THE

CLASSES IN A PACKAGE,YOU REUSETHEMKEL.

The Common-Closure Principle(CCP)共同封闭原则 256

THE CLASSES IN A PACKAGE SHOULD BE CLOSED TOGETHER AGAINST THE SAME KINDS 0F CHANGES.A CHANGE THAT AFFECTS A PACKAGE AFFECTS ALL THE CLASSES IN THAT PACKAGE AND NO OTHER PACKAGES.

Summary of Package Cohesion包内聚性总结 256

Stability:The Principles 0f Package Coupling包的耦合性原则:稳定性 256

The Acyclic-Dependencies Principle(ADP)无环依赖原则 256

ALLOW NO CYCLES IN THE PACKAGE DEPENDENCY GRAPH.

The Weekly Build每周构建 257

Eliminating Dependency Cycles消除依赖环 257

The Effect of a Cycle in the Package Dependency Graph 258

环在包依赖关系图中造成的影响

Breaking the Cycle解除依赖环 259

The“Jitters”颠簸 259

Top-Down Design 自顶向下设计 260

The Stable-Dependencies Principle(SDP)稳定依赖原则(SDP) 261

DEPEND IN TIlE DIRECTION OF STABILITK

Stability稳定性 26 1

Stability Metrics稳定性度量 262

Not All Packages Should Be Stable并非所有包都应该是稳定的 263

Where Do We Put the High-level Design?高层设计的位置 264

The Stable-Abstractions Pri nciplc(SAP)稳定抽象原则(SAP) 264

A PACKAGE SHLOUD BE AS ABSTRACT As IT IS STABLE.

Measuring Abstraction抽象性度量 265

The Main Sequence主序列 265

Distance from the Main Sequence到主序列的距离 266

Conclusion结论 268

Chapter 21 FACTORY FACTORY模式 269

A Dependency Cycle依赖环 27 l

Substitutable Factories可替换的工厂 272

Using Factories for Test Fixtures对测试支架使用工厂 273

How Important Is It to Use Factories?工厂的重要性 274

Conclusion结论 274

Bibliography参考文献 274

Chapter 22 The Payroll Case Study(Part 2)薪酬系统案例研究:第2部分 275

Package Structure and Notation包结构与图示 276

Applying the Common Closure Principle rCCPl应用CCP 277

Applying the Reuse Release Equivalency Principle(REP)应用REP 278

Coupling and Encapsulation耦合和封装 279

Metrics度量 279

Applying the Metrics to the Payroll Application度量薪酬应用程序 282

Object Factories对象工厂 285

The Object Factory for Transactionlmplementation

Transactionlmplementation的对象工厂 286

Initializing the Factories初始化工厂 286

Rethinking the Cohesion Boundaries重新思考内聚的边界 287

The Final Package Structure最终的包结构 287

Conclusion结论 290

Bibliography参考文献 290

Section 5 The Weather Station Case Study气象站案例研究 291

Chapter23 COMPOSITE COMPOSITE模式 293

Example:Composite Commands示例:组合命令 294

Multiplicity or Not Multiplicity多重性还是非多重性 295

Chapter 24 OBSERVERIBacking into a Pattern OBSERVER--演化出模式 297

The Digital Clock数字时钟 297

Conclusion结论 314

The Use ofDiagrams in this Chapter本章中图的使用 314

Thc OBSERVER Pattern OBSERVER模式 3l5

How OBSERVER Manages the Principles ot’OOD OBSERVER中应用的OOD原则 316

Bibliography参考文献 316

Chapter25 ABSTRACT SERVER,ADAPTER,and BRIDGE 317

ABSTRACT SERVER模式、ADAPTER模式和BRIDGE模式 317

ABSTRACT SERVER ABSTRACT SERVER模式 318

Who Owns the Interface?谁拥有接口 318

Adapter ADAPTER模式 319

The class Form of ADAPTEP,类形式的ADAPTER模式 319

The Modem Problem,ADAPTERS and LSP调制解调器问题、适配器以及LSP 320

BRIDGE BRIDGE模式 322

Conclusion结论 324

Bibliography参考文献 325

Chapter26 PROXY and STAIRWAY TO HEAVEN:Managing Third Party APIs

PROXY模式和GATEWAY模式:管理第三方APl 327

PROXY PROXY模式 327

ProxifVing the Shopping Cart为购物车创建代理 332

Summary ot’PROXY PROXY小结 344

Dealing with Databases.Middleware,and Other Third Party Interfaces使用数据库、中间件以及其他第三方接口 345

STAIRWAY TO HEAVEN STAIRWAY TO HEAVEN模式 347

Example of STAIP,WAY TO HEAVEN STAIRWAYTO HEAVEN示例 348

Other Patterns That Can Be Used with Databases可用于数据库的其他模式 353

Conclusion结论 354

Bibliography参考文献 354

Chapter 27 Case Study:Weather Station案例研究:气象站软件 355

The Cloud Company Cloud公司 355

The WMS-LC Soflware WMS-LC软件 356

Language Selection语言选择 357

Nimbus-LC Software Design Nimbus-LC软件设计 357

24一Hour History and Persistence 24小时历史及持久化 368

Implementing the HiLo Algorithms实现HiLo算法 371

Conclusion结论 379

Bibliography参考文献 379

Nimbus-LC Requirements Overview Nimbus-LC需求概述 379

Usage Requirements使用需求 379

24一Hour History 24小时历史 379

User Setup用户设置 379

Administrative Requirements管理需求 380

Nimbus-LC Use Cases Nimbus-LC用例 380

Actors参与者 380

UseCases用例 380

Measurement History测量历史 380

Setup设置 381

Administration管理 381

Nimbus-LC Release Plan Nimbus-LC发布计划 3 8 1

Introduction小引 3 8 1

Release I 381

Risks风险 382

Deliverable(s)交付物 382

Release II 382

Use Cases Implemented实现的用例 382

Risks风险 383

Deliverable(s)交付物 383

Rclease III 383

Use Cases Implemented实现的用例 383

Risks风险 383

Deliverable(s)交付物 383

Section 6 The ETS Case Study ETS案例研究 385

Chapter 28 VISITOR VISITOR模式 387

The VISITOR Family of Design Patterns VISITOR系列设计模式 388

VISITOR VISITOR模式 388

VISITOR is Like a Matrix VISITOR就像一个矩阵 391

ACYCLIC VISITOR ACYCLICVISITOR模式 391

ACYCLIC VISITOR ls Like a Sparse Matrix ACYCLIC VISITOR就像一个稀疏矩阵 396

Using VISITOR in Report Generators在报表生成器中使用ⅥsIToR模式 396

Other Uses of VISITOR VISITOR的其他用途402

DECORATOR DEcoRAToR模式 403

Multiple Decorators多个装饰器406

EXTENSION OB IECT EXTENSION OBJECT模式408

Conclusion结论 418

Reminder提醒418

Bibliography参考文献 4l8

Chapter29 STATE STATE模式 419

Overview of Finite State Automata FSM概述 419

Implementation Techniques 实现技术 421

Nested Switch/Case Statement嵌套switch/case语句 421

Interpreting Transition Tables 解释迁移表 424

The STATE Pattern STATE模式426

SMC T11c State-Machine Compiler状态机编译器429

Where Should State Machines be Used?状态机的应用场合 432

High-Level Application Policies for GUIs GUI高层应用策略 432

GUI Interaction Controllers GUI交互控制器 433

Distributed Processing分布式处理 433

Conclusion结论 434

Listings代码清单 434

Turnstile.Java Using Table Interpretation使用表解释 434

Turnstile.Java Generated by SMC.and Other Support Files

SMC生成的Turnstile.Java以及其他支持文件 437

Bibliography参考文献 441

Chapter 30 The ETS Framework ETS框架 443

Introduction简介 443

Project Overview项目概述 443

Early History 1993-1994早期历史 445

Framework?框架? 445

Framework!框架1 446

The 1994 Team 1994年的团队 446

The Deadline最后期限 446

The Strategy策略 446

Results结果 447

Framework Design框架设计 448

The Common Requirements of the Scoring Applications评分程序的主要需求 448

The Design of the Scoring Framework评分框架的设计 450

A Case for TEMPLATE METHOD应用TEMPLATE METHOD 453

Write a Loop Once一次只写一个循环 454

The Common Requirements of the Delivery Applications考试程序的主要需求 456

The Design of the Delivery Framework考试框架的设计 457

The Taskmaster Architecture任务控制架构 462

Conclusion结论 465

Bibliography参考文献 466

AppendixA UML Notation I:The CGI Example UML图示之一:CGI示例 467

Course Enrollment System:Problem Description课程注册系统:问题描述 468

Actors参与者 469

UseCases用例 469

The Domain Model领域模型 472

The Architecture架构 476

Abstract Classes and Interfaces in Sequence Diagrams序列图中的抽象类和接口 485

Summary总结 486

Bibliography参考文献 487

Appendix B UML Notation II:The STATMUX UML图示之二:STATMUX 489

The Statistical Multiplexor Definition统计多路复用器的定义 489

The Software Environment软件环境 490

The Real-time Constraints实时限制 490

The Input Interrupt Service Routine输入中断服务例程 491

The Output Service Interrupt Routine输出服务中断的例程 495

The Communications Protocol通信协议 496

Conclusion结论 506

Bibliography参考文献 506

Appendix C A Satire of Two Companies双公司记 507

RufuS,Inc.

Project Kickoff 507

Rupert Industries

Project:~Alpha~ 507

AppendixD The Source Code Is the Design源代码就是设计 517

What Is Software Design? 什么是软件 517

Afterword 跋 523

Index 525