Implementation Patterns (Paperback)
暫譯: 實作模式 (平裝本)

Kent Beck

買這商品的人也買了...

相關主題

商品描述

Description 

“Kent is a master at creating code that communicates well, is easy to understand, and is a pleasure to read. Every chapter of this book contains excellent explanations and insights into the smaller but important decisions we continuously have to make when creating quality code and classes.”

Erich Gamma, IBM Distinguished Engineer

 

“Many teams have a master developer who makes a rapid stream of good decisions all day long. Their code is easy to understand, quick to modify, and feels safe and comfortable to work with. If you ask how they thought to write something the way they did, they always have a good reason. This book will help you become the master developer on your team. The breadth and depth of topics will engage veteran programmers, who will pick up new tricks and improve on old habits, while the clarity makes it accessible to even novice developers.”

Russ Rufer, Silicon Valley Patterns Group

 

“Many people don’t realize how readable code can be and how valuable that readability is. Kent has taught me so much, I’m glad this book gives everyone the chance to learn from him.”

Martin Fowler, chief scientist, ThoughtWorks

 

“Code should be worth reading, not just by the compiler, but by humans. Kent Beck distilled his experience into a cohesive collection of implementation patterns. These nuggets of advice will make your code truly worth reading.”

Gregor Hohpe, author of Enterprise Integration Patterns

 

“In this book Kent Beck shows how writing clear and readable code follows from the application of simple principles. Implementation Patterns will help developers write intention revealing code that is both easy to understand and flexible towards future extensions. A must read for developers who are serious about their code.”

Sven Gorts

 

Implementation Patterns bridges the gap between design and coding. Beck introduces a new way of thinking about programming by basing his discussion on values and principles.”

Diomidis Spinellis, author of Code Reading and Code Quality

 

Software Expert Kent Beck Presents a Catalog of Patterns Infinitely Useful for Everyday Programming

 

Great code doesn’t just function: it clearly and consistently communicates your intentions, allowing other programmers to understand your code, rely on it, and modify it with confidence. But great code doesn’t just happen. It is the outcome of hundreds of small but critical decisions programmers make every single day. Now, legendary software innovator Kent Beck–known worldwide for creating Extreme Programming and pioneering software patterns and test-driven development–focuses on these critical decisions, unearthing powerful “implementation patterns” for writing programs that are simpler, clearer, better organized, and more cost effective.

 

Beck collects 77 patterns for handling everyday programming tasks and writing more readable code. This new collection of patterns addresses many aspects of development, including class, state, behavior, method, collections, frameworks, and more. He uses diagrams, stories, examples, and essays to engage the reader as he illuminates the patterns. You’ll find proven solutions for handling everything from naming variables to checking exceptions.

 

This book covers

  • The value of communicating through code and the philosophy behind patterns
  • How and when to create classes, and how classes encode logic
  • Best practices for storing and retrieving state
  • Behavior: patterns for representing logic, including alternative paths
  • Writing, naming, and decomposing methods
  • Choosing and using collections
  • Implementation pattern variations for use in building frameworks

Implementation Patterns will help programmers at all experience levels, especially those who have benefited from software patterns or agile methods. It will also be an indispensable resource for development teams seeking to work together more efficiently and build more maintainable software. No other programming book will touch your day-to-day work more often.

Table of Contents

Preface  xv

Chapter 1: Introduction  1

Tour Guide  3

And Now...  4

Chapter 2: Patterns  5

Chapter 3: A Theory of Programming  9

Values  10

Principles  13

Conclusion  18

Chapter 4: Motivation  19

Chapter 5: Class  21

Class  22

Simple Superclass Name  23

Qualified Subclass Name  24

Abstract Interface   24

Interface  26

Abstract Class  26

Versioned Interface  27

Value Object  28

Specialization  31

Subclass  32

Implementor  34

Inner Class  34

Instance-Specific Behavior  36

Conditional  36

Delegation  38

Pluggable Selector  40

Anonymous Inner Class  41

Library Class  41

Conclusion  42

Chapter 6: State  43

State  44

Access  45

Direct Access  46

Indirect Access  47

Common State  47

Variable State  48

Extrinsic State  50

Variable  50

Local Variable  51

Field  52

Parameter  53

Collecting Parameter  55

Optional Parameter  56

Var Args  56

Parameter Object  57

Constant  58

Role-Suggesting Name  58

Declared Type  60

Initialization  61

Eager Initialization  61

Lazy Initialization  62

Conclusion  62

Chapter 7: Behavior  63

Control Flow  64

Main Flow  64

Message  65

Choosing Message  65

Double Dispatch  66

Decomposing (Sequencing) Message  67

Reversing Message  67

Inviting Message  68

Explaining Message  69

Exceptional Flow  70

Guard Clause  70

Exception  72

Checked Exceptions  72

Exception Propagation  73

Conclusion  73

Chapter 8: Methods  75

Composed Method  77

Intention-Revealing Name  79

Method Visibility  80

Method Object  82

Overridden Method  83

Overloaded Method  83

Method Return Type  84

Method Comment  85

Helper Method  85

Debug Print Method  86

Conversion  87

Conversion Method  87

Conversion Constructor  88

Creation  88

Complete Constructor  89

Factory Method  90

Internal Factory  91

Collection Accessor Method  91

Boolean Setting Method  93

Query Method  93

Equality Method  94

Getting Method  95

Setting Method  96

Safe Copy  97

Conclusion  98

Chapter 9: Collections  99

Metaphors  100

Issues  101

Interfaces  103

Implementations  107

Collections  110

Extending Collections  114

Conclusion  115

Chapter 10: Evolving Frameworks  117

Changing Frameworks without Changing Applications  117

Incompatible Upgrades  118

Encouraging Compatible Change  120

Conclusion  129

Appendix A: Performance Measurement  131

Example  131

API  132

Implementation  133

MethodTimer  134

Canceling Overhead  136

Tests  136

Conclusion  142

Bibliography  145

General Programming  145

Philosophy  147

Java  148

Index  149

商品描述(中文翻譯)

描述

「Kent 是一位擅長創建易於理解且令人愉悅的代碼的大師。本書的每一章都包含了對於在創建高品質代碼和類別時,我們不斷需要做出的較小但重要決策的出色解釋和見解。」
– *Erich Gamma, IBM 傑出工程師*

「許多團隊都有一位大師級開發者,他們整天快速做出良好的決策。他們的代碼易於理解,修改迅速,並且讓人感到安全和舒適。如果你問他們為什麼以這種方式編寫代碼,他們總是有很好的理由。本書將幫助你成為團隊中的大師級開發者。廣泛而深入的主題將吸引資深程序員,他們將學到新技巧並改善舊習慣,而清晰的表達使得即使是初學者也能輕鬆理解。」
– *Russ Rufer, 硅谷模式小組*

「許多人並未意識到代碼的可讀性有多高,以及這種可讀性有多麼珍貴。Kent 教會了我很多,我很高興這本書讓每個人都有機會向他學習。」
– *Martin Fowler, ThoughtWorks 首席科學家*

「代碼應該值得閱讀,不僅僅是由編譯器,而是由人類。Kent Beck 將他的經驗提煉成一個有凝聚力的實現模式集合。這些建議將使你的代碼真正值得閱讀。」
– *Gregor Hohpe, 《企業整合模式》作者*

「在這本書中,Kent Beck 展示了如何通過應用簡單原則來編寫清晰且可讀的代碼。《實現模式》將幫助開發者編寫意圖明確的代碼,這些代碼既易於理解,又對未來的擴展具有靈活性。對於認真對待自己代碼的開發者來說,這是必讀之作。」
– *Sven Gorts*

《實現模式》彌合了設計與編碼之間的鴻溝。Beck 透過基於價值觀和原則的討論,介紹了一種新的編程思維方式。

軟體專家 Kent Beck 提供了一個對日常編程無限有用的模式目錄

優秀的代碼不僅僅是運行:它清晰且一致地傳達你的意圖,讓其他程序員能夠理解你的代碼,依賴它,並自信地進行修改。但優秀的代碼並不是自然而然產生的。它是程序員每天做出數百個小而關鍵決策的結果。現在,傳奇的軟體創新者 Kent Beck——因創建極限編程和開創軟體模式及測試驅動開發而聞名於世——專注於這些關鍵決策,挖掘出強大的「實現模式」,以編寫更簡單、更清晰、更有組織且更具成本效益的程序。

Beck 收集了 77 種模式,用於處理日常編程任務和編寫更具可讀性的代碼。這個新的模式集合涵蓋了開發的許多方面,包括類別、狀態、行為、方法、集合、框架等。他使用圖表、故事、範例和文章來吸引讀者,並闡明這些模式。你將找到處理從命名變數到檢查異常的經驗法則。

本書涵蓋的內容包括:
- 通過代碼進行溝通的價值及模式背後的哲學
- 如何以及何時創建類別,以及類別如何編碼邏輯
- 存儲和檢索狀態的最佳實踐
- 行為:表示邏輯的模式,包括替代路徑
- 編寫、命名和分解方法
- 選擇和使用集合
- 用於構建框架的實現模式變體

《實現模式》將幫助各個經驗水平的程序員,特別是那些受益於軟體模式或敏捷方法的人。它也將成為開發團隊尋求更高效合作和構建更易維護軟體的不可或缺的資源。沒有其他編程書籍會如此頻繁地影響你的日常工作。

目錄
前言 xv
第一章:介紹 1
導覽 3
現在... 4
第二章:模式 5
第三章:編程理論 9
價值觀 10
原則 13
結論 18
第四章:動機 19
第五章:類別 21
類別 22
簡單超類名稱 23
合格子類名稱 24
抽象介面 24
介面 26
抽象類別 26
版本化介面 27
值物件 28
專門化 31
子類 32
實現者 34
內部類別 34
實例特定行為 36
條件 36
委派 38
可插拔選擇器 40
匿名內部類別 41
庫類別 41
結論 42
第六章:狀態 43
狀態 44
訪問 45
直接訪問 46
間接訪問 47
公共狀態 47
變數狀態 48
外部狀態 50
變數 50
局部變數 51
欄位 52
參數 53