Section I:Agile D evelop ment敏捷開發(fā) 1
Chapter 1:Agile Practices敏捷實踐 3
The Agile Alliance敏捷聯(lián)盟 4
Individuals and Interactions over Processes and Tools人和交互重于過程和工具 5
Working Software over Comprehensive Documentation
可以工作的軟件重于面面俱到的文檔 6
Customer Collaboration over Contract NegOtiatiOn客戶合作重于合同談判 6
Responding to Change over Following a Plan隨時應對變化重于遵循計劃 7
Principles原則 10
Conclusion結論 10
Bibliography參考文獻 11
Chapter 2:Overview of Extreme Programming極限編程概述 13
The Practices of Extreme Programming極限編程實踐 14
Whole Team完整團隊 l4
User Stories用戶故事 15
Short Cycles短交付周期 16
Acceptance Tests驗收測試 16
Pair Programming結對編程 16
Test.Driven Development(TDD)測試驅動開發(fā) 17
Collective Ownership集體所有權 17
Continuous Integration持續(xù)集成 17
Sustainable Pace可持續(xù)的開發(fā)速度 18
Open Workspace開放的工作空間 18
The Planning Game計劃游戲 19
Simple Design簡單設計 19
Refactoring重構 20
Metaphor 隱喻 21
Conclusion結論 22
Bibliography參考文獻 22
Chapter 3:Planning計劃 23
lnitial Exploration初始探索 24
Spiking,Splitting,and Velocity探究、分解和速度 24
Release Planning發(fā)布計劃 25
Iteration Planning迭代計劃 25
Defining“Done”定義“完成” 26
Tlask Planning任務計劃 26
Iterating迭代 27
Tracking跟蹤 28
Conclusion結論 29
Bibliography參考文獻 29
Chapter 4:Testing測試 31
TIest-Driven Development測試驅動開發(fā) 32
Example of Test—First Design測試優(yōu)先設計的例子 32
Test Isolation測試促使模塊之間隔離 33
Serendipitous Decoupling意外獲得的解耦合 36
Acceptance Tests驗收測試 36
Serendipitous Architecture意外獲得的構架 37
Conclusion結論 38
Bibliography參考文獻 39
Chapter 5:Refactoring重構 41
A Simple Example of Refactoring:Generating Primes素數(shù)產生程序:一個簡單的重構示例 42
Unit Testing單元測試 44
Refactoring重構 45
The Final Reread最后審視 49
Conclusion結論 53
Bibliography參考文獻 54
Chapter 6:A Programming Episode一次編程實踐 55
The Bowling Game保齡球比賽 56
Conclusion結論 98
Overview of the Rules of Bowling保齡球規(guī)則概述 99
Section II Agile D esign敏捷設計 101
Chapter 7:What Is Agile Design什么是敏捷設計 103
Design Smells設計臭味 104
Design Smells--The Odors of Rotting Software設計壞味——腐化軟件的氣味 104
Rigidity僵化性 105
Fragility脆弱性 105
Immobility頑固性 105
Viscosity粘滯性 105
Needless Complexity不必要的復雜性 106
NeedLless Repetition不必要的重復 106
Opacity晦澀性 107
Why Software Rots軟件為何會腐化 107
The Copy Program Copy程序 108
A Familiar Scenario熟悉的場景 108
Agile Design of the Copy Program copy程序的敏捷設計 111
Conclusion結論 1l 3
Bibliography參考文獻 114
Chapter 8:The Single-Responsibility Principle(SRP)
S R P:單一職責原則 1l 5
Defining a Responsibility定義職責 117
Separating Coupled Responsibilities分離耦合的職責 119
Persistence持久化 119
Conclusion結論 119
Bibliography參考文獻 120
Chapter 9:The Open/Closed Principle(OCP)
OC P:開放一封閉原貝IJ 12l
Description 0f oCP OCP概述 122
The Shape Application Shape應用程序 124
Violating OCP違反OCP 124
Conforming to OCP j望循OCP 127
Anticipation and“Natural”Structure預測變化和“貼切的”結構 128
Putting the“Hooks”In放置吊鉤 129
Using Abstraction to Gain Explicit Closure使用抽象獲得顯式封閉 13O
Using a Data--Driven Approach to Achieve Closure
使用“數(shù)據驅動"的方法獲取封閉性 131
Conclusion結論 132
Bibliography參考文獻 133
Chapter 10:The Liskov Substitution Principle(LSP)
LS P:Liskov替換原則 135
Violations 0f LSP違反LS P的情形 136
A Simple Example簡單例子 136
A More Subtle Violation更微妙的違反情形 138
A Real.World Example實際的例子 143
Factoring Instead of Deriving用提取公共部分的方法代替繼承 148
Heuristics and Conventions啟發(fā)式規(guī)則和習慣用法 15O
Conclusion結論 151
Bibliography參考文獻 151
Chapter 11:The Dependency--Inversion Principle(DIP)
D I P:依賴倒置原則 153
Layering層次化 l 54
Ownership Inversion倒置的接口所有權 155
Dependence on Abstractions依賴于抽象 156
A Simple DIP Example簡單的D l P示例 157
Finding the Underlying Abstraction找出潛在的抽象 158
The Furnace Example熔爐示例 160
Conclusion結論 161
Bibliography參考文獻 162
Chapter 12:The Interface Segregation Principle(ISP)
ISP:接口隔離原則 163
Interface Pollution接口污染 163
Separate Clients Mean Separate Interfaces分離客戶就是分離接口 165
Class Interfaces versus Obj ect Interfaces類接口與對象接口 166
Separation Through Delegation使用委托分離接口 167
Separation Through Multiple Inheritance使用多重繼承分離接口 168
The ATM User Interface Example ATM用戶界面的例子 169
Conclusion結論 174
Bibliography參考文獻 175
Chapter 13 Overview of UML for Cjfj6Programmers c≠}程序員UM嘲 177
Class Diagrams類圖 180
Obj ect Diagrams對象圖 182
Sequence Diagrams順序圖 182
Collaboration Diagrams協(xié)作圖 183
State Diagrams狀態(tài)圖 184
Conclusion結論 185
Bibliography參考文獻 j185
Chapter 14:Working with Diagrams使用UML 187
Why Model?為什么建模 187
Why Build Models of Software'?為什么構建軟件模型 188
Should We Build Comprehensive Designs Before Coding?--編碼前應該構建面面俱到的設計嗎 188
Making Effective Use of UML有效使用U M L 189
Communicating with Others與他人交流 189
Road Maps脈絡圖 191
Back-End Documentation項目結束文檔 192
What to Keep and What to Throw Away要保留的和要丟棄的 192
Iterative Refinement迭代式改進 194
Behavior First行為優(yōu)先 194
Check the Structure檢查結構 196
Envisioning the Code想象代碼 198
Evolution of Diagrams圖的演化 199
When and How to Draw Diagrams何時以及如何繪制圖示 200
When to Draw Diagrams and When to Stop何時要畫圖,何時不要畫圖 200
CASE Tools CASE工具 201
But What About Documentation?那么,文檔呢 202
Conclusion結論 202
Chapter 15 State Diagrams狀態(tài)圖 203
The Basics基礎知識 204
Special Events特定事件 205
Superstates超狀態(tài) 206
Initial and Final Pseudostates初始偽狀態(tài)和結束偽狀態(tài) 207
Using FSM Diagrams使用FSM圖示 208
Conclusion結論 209
Chapter 16:Obj ect Diagrams對象圖 211
A Snapshot in Time即時快照 212
Active Obj ects主動對象 213
Conclusion結論 217
C hapter 17:Use C ases j~N 219
Writing Use Cases編寫用例 220
Alternate Courses備選流程 221
What Else?其他東西呢 221
Diagramming Use Cases用例圖 222
Conclusion結論 223
Bibliography參考文獻 223
Chapter 18:Sequence Diagrams順序圖 225
The Basics基礎知識 226
Obj ects,Lifelines,Messages,and Other Odds and Ends對象、生命線、消息及其他 226
Creation and Destruction創(chuàng)建和析構 227
Simple Loops簡單循環(huán) 228
Cases and Scenarios時機和場合 228
Advanced Concepts高級概念 232
Loops and Conditions循環(huán)和條件 232
Messages That Take Time耗費時間的消息 233
Asynchronous Messages異步消息 235
Multiple Threads多線程 239
Active Obj ects主動對象 240
Sending Messages to Interfaces向接口發(fā)送消息 240
Conclusion結論 241
C hapter 19:Class Diagrams類圖 243
The Basics基礎知識 244
Classes類 244
Association關聯(lián) 245
Inheritance繼承 246
An Example Class Diagram類圖示例 247
The Details細節(jié) 249
Class Stereotypes類衍型 249
Abstract Classes抽象類 250
Properties屬性 251
Aggregation聚集 252
Composition組合 253
Multiplicity多重性 254
Association Stereotypes關聯(lián)衍型 255
Nested Classes內嵌類 256
Association Classes關聯(lián)類 256
Association Qualifiers關聯(lián)修飾符 257
Conclusion結論 258
Bibliography參考文獻 258
Chapter 20 Heuristics and C0ffee咖啡的啟示 259
The Mark IV Special Coffee Maker Mark lV型專用咖啡機 260
Specification規(guī)格說明書 260
A Common but Hideous Solution常見的丑陋方案 263
Imaginary Abstraction虛構的抽象 265
An Improved Solution改進方案 266
Implementing the Abstract Model實現(xiàn)抽象模型 270
The Benefits of This Design這個設計的好處 277
OOverkill面向對象過度設計 279
Bibliography參考文獻 292
Section 1II The Payroll C ase Study薪水支付案例研究 293
Rudimentary Specification of the Payroll System薪水支付系統(tǒng)的初步規(guī)格說明 294
Exercise練習 295
Use Case 1:Add New Employee用例1:增加新雇員 295
Use Case 2:Deleting an Employee用例2:刪除雇員 295
Use Case 3:Post a Time Card用例3:登記考勤卡 296
Use Case 4:Posting a Sales Receip t用例4:登記銷售憑條 296
Use Case 5:Posting a Union Service Charge用例5:登記工會服務費 296
Use Case 6:Changing Employee Details用例6:更改雇員明細 296
Use Case 7:Run the Payroll for Today用例7:現(xiàn)在運行薪水支付系統(tǒng) 297
Chapter 21:Command and Active Obj ect:Versatility and Multitasking COM MAN D模式和ACTlVE OBJECT模式:多功能與多任務 299
Simple Commands簡單的Command 300
Transactions事務 302
Physical and Temporal Decoupling實體上解耦和時間上解耦 304
Temporal Decoupling時間上解耦 304
Undo Method Undo()方法 304
Active Obj ect ACTIVE OBJ ECT模式 305
Conclusion結論 31O
Bibliography參考文獻 31O
Chapter 22:Template Method and Strategy-.Inheritance versus Delegation TEMPLATE METHOD模式~13STRATEGY模式:繼承和委托 311
Template Method TEM PLATE M ETHOD模式 312
Pattern Abuse濫用模式 315
Bubb l e S o r t冒泡排序 316
Strategy STRATEGY模式 319
Conclusion結論 324
Bibliography參考文獻 324
Chapter 23"Facade and Mediator FACAD E模式~13MEDIATO R模式 325
Facade FACAD E模式 325
Mediator M E D IATOR模式 327
Conclusion結論 329
Bibliography參考文獻 329
Chapter 24"一Singleton and Monostate SlNGL日_ON模式和MONOSTATE模式 331
Singleton SI N G LETON模式 332
Benefits SINGLETON模式的好處 334
Costs SINGLETON模式的代價 334
Singleton in Action運用SINGLETON模式 334
Monostate MO NOSTATE模式 336
Benefits MONOSTATE模式的好處 337
Costs MONOSTATE模式的代價 338
Monostate in Action運用MONOSTATE模式 338
Conclusion結論 343
Bibliography參考文獻 343
Chapter 25:Null Obj ect NULL OBJECT 345
Description描述 345
Conclusion結論 348
Bibliography參考文獻 348
Chapter 26:The Payroll Case Study:Iteration 1
薪水支付案例研究:第一次迭代開始 349
Rudimentary Specification初步的規(guī)格說明 350
Analysis by Use Cases基于用例分析 351
Adding Employees增加新雇員 352
Deleting Employees刪除雇員 353
Posting Time Cards登記考勤卡 354
Posting Sales Receipts登記銷售憑條 354
Posting a Union Service Charge登記工會服務費 355
Changing Employee Details更改雇員明細 356
Payday發(fā)薪日 358
Reflection'.Finding the Underlying Abstractions反思:找出底層的抽象 360
Employee Payment雇員支付類別抽象 360
Payment Schedule支付時間表抽象 360
Payment Methods支付方式 362
Affiliations從屬關系 362
Conclusion結論 363
Bibliography參考文獻 363
Chapter 27"The Payroll Case Study:Implementation
薪水支付案例研究:實現(xiàn) 365
Transactions事務 366
Adding Employees增加雇員 366
Deleting Employees刪除雇員 372
Time Cards,Sales Receipts,and Service Charges考勤卡、銷售憑條以及服務費用 373
Changing EmplOyees更改雇員屬性 381
What Was I Smoking?犯了什么暈 390
Paying Employees支付雇員薪水 393
Paying Salaried Employees支付領月薪的雇員薪水 396
Paying Hourly Employees支付鐘點工薪水 398
Main Program主程序 408
The Database數(shù)據庫 409
Conclusion結論 411
About This Chapter關于本章 411
Bibliography參考文獻 412
Section IV:Packaging the Payroll System
打包薪水支付系統(tǒng) 413
Chapter 28:Principles of Package
an d C o mp o n ent D esign包和組件的設計原則 415
Packages and Components包和組件 416
Principles of Component Cohesion:Granularity組件的內聚性原則:粒度 417
The Reuse/Release Equivalence Principle(REP)重用一發(fā)布等價原則 417
The Common Reuse Principle(CRP)共同重用原則 418
The Common Closure Principle(ccP)共同封閉原則 419
Summary of Component Cohesion組件內聚性總結 420
Principles of Component Coupling:Stability組件的耦合陛原則:穩(wěn)定性 420
The Acyclic Dependencies Principle(ADP)無環(huán)依賴原則 420
The Stable—Dependencies Principle(SDP)穩(wěn)定依賴原則 426
The Stable—Abstractions Principle(SAP)穩(wěn)定抽象原則 431
Conclusion結論 “435
Chapter 29"Factory FACTORY~ 437
A Dependency Problem依賴問題 √440
Static versus Dynamic Typing靜態(tài)類型與動態(tài)類型 √441
SubStitutable Factories可替換的工廠 “442
Using Factories for TIest Fixtures對測試支架使用對象工廠 √443
Importance of Factories工廠的重要性 “444
Conclusion結論 445
Bibliography參考文獻 445
Chapter 30:The Payroll Case Study:Package Analysis
薪水支付案例研究:包分析 447
Component Structure and Notation組件結構和符號 448
Applying the Common Closure Principle(CCP)/EIII CCP 450
Applying the Reuse/Release Equivalence Principle(REP)/E,EB REP 452
Coupling and Encapsulation耦合和封裝 454
Metrics度量 455
Applying the Metrics to the Payroll Application度量薪水支付應用程序 457
Obj ect Factories x,/N2J- 460
Rethinking the Cohesion Boundaries重新思考內聚的邊界 461
The Final Packaging Structure最終的包結構 463
Conclusion結論 465
Bibliography參考文獻 465
C hapter 31:C omposite COM POSITE模式 467
Composite Commands組合命令 469
Multiplicity or No Multiplicity多重性還是非多重性 470
Conclusion結論 470
Chapter 32"Observer"Evolving into a Pattern
O BS E RVE R——演化至模式 47l
The Digital Clock數(shù)字時鐘 472
The Observer Pattern OBSE RVE R模式 491
Models模型 491
Management of OOD Principles面向對象設計原則的運用 492
Conclusion結論 493
Bibliography參考文獻 494
Chapter 33"Abstract Server,Adapter,and Bridge
ABSTRACT S E RVE R模式、ADAPTE R模式~I:IBRIDG E模式 495
Abstract Server ABSTRACT S E RVE R模式 496
Adapter ADAPTE R模式 498
The Class Form of Adapter類形式ADAPTER模式 498
The Mode,m Problem,Adapters,and LSP調制解調器問題、適配器以及LSP 499
Bridge BRI DG E模式 503
Conclusion結論 505
Bibliography參考文獻 506
Chapter 34"Proxy and Gateway".Managing
Third-Party APIs P ROXY模式~N GATEWAY模式:管理第三方API 507
Proxy PROXY模式 508
Implementing Proxy實現(xiàn)PROXY模式 512
Summary小結 525
Databases,Middleware,and Other Third.Party Interfaces
數(shù)據庫、中間件以及其他第三方接口 526
Table Data Gateway TABLE DATA GATEWAY 528
Testing and In.Memory TDGs測試和內存TDG 535
Testing the DB Gateways測試DbGatel\№y 536
Using Other Patterns with Databases可以用于數(shù)據庫的其他模式 539
Conclusion結論 541
Bibliography參考文獻 541
C hapter 35"Visitor VI S ITO R模式 543
VISITOR VI S ITO R模式 544
Acyclic Visitor ACYCLI C VI SITOR模式 548
U ses of VISITOR使用VISITOR模式 552
Decorator D ECO RATOR模式 560
Extension Obj ect EXTE N S IO N O BJ ECT模式 565
Conclusion結論 576
Bibliography參考文獻 577
Chapter 36:State STATE模式 579
Nested Swi tch/Case Statements嵌套switch/case語句 580
The Internal Scope State Variable內部作用域的狀態(tài)變量 583
Testing the Actions測試動作 583
Costs and Benefits代價和收益 583
Transition Tables遷移表 584
Using Table Interpretation使用表解釋 585
Costs and Benefits代價和收益 586
The State Pattern STATE模式 586
State versus Strategy STATE模式和STRATEGY模式 589
Costs and Benefits代價和收益 590
T]he State Machine Compiler(SMCl狀態(tài)機編譯器 591
Turnstile.CS Generated by SMC.and Other Support Files
SMC生成的Turns t i l e.C S以及其他支持文件 593
Costs and Benefits代價和收益 598
Classes of State Machine Application狀態(tài)機應用的場合 598
High—Level Application Policies for GUIs作為GUI中的高層應用策略 599
GUI Interaction Controllers GUI交互控制器 600
Distributed Processing分布式處理 601
C onclusion結論 602
Bibliography參考文獻 602
Chapter 37 The Payroll Case Study'.The Database
薪水支付案例研究:數(shù)據庫 603
Building the Database構建數(shù)據庫 604
A Flaw in the Code Design一個代碼設計缺陷 605
Adding an E mployee增加雇員 607
Transactions事務 618
Loading an E mployee加載Employee對象 623
What Remains?還有什么工作 636
Chapter 38 The Payroll User Interface"Model View
Presenter薪水支付系統(tǒng)用戶界面:Model—View—P resente r 637
The Interface界面 639
Implementation實現(xiàn) 640
Building a Window構建窗口 650
The Payroll Window Payroll窗口 657
The Unveiling真面目 669
Conclusion結論 670
Bibliography參考文獻 670
Appendix A:A Satire of Two C ompanies雙公司記 671
Rufus Inc.:Proj ect Kickoff Rufus公司:“日落”項目 671
Rupert Industries'.Proj ect Alpha Rupert工業(yè)公司:“朝暉”項目 671
Appendix B:What Is Software?什么是軟件 687
Index索引 699