Implementation Patterns

  • ISBN13:


  • ISBN10:


  • Edition: 1st
  • Format: Paperback
  • Copyright: 2007-10-23
  • Publisher: Addison-Wesley Professional
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $10.40
  • Buy New
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


"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 donrs"t realize how readable code can be and how valuable that readability is. Kent has taught me so much, Irs"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 ofEnterprise Integration Patterns "In this book Kent Beck shows how writing clear and readable code follows from the application of simple principles.Implementation Patternswill 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 Patternsbridges 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 ofCode ReadingandCode Quality Software Expert Kent Beck Presents a Catalog of Patterns Infinitely Useful for Everyday Programming Great code doesnrs"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 doesnrs"t just happen. It is the outcome of hundreds of small but critical decisions programmers make every single day. Now, legendary software innovator Kent Beckknown worldwide for creating Extreme Programming and pioneering software patterns and test-driven developmentfocuses 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

Author Biography

Kent Beck, one of the software industry’s most creative and acclaimed leaders, consistently challenges software engineering dogma and promotes ideas like patterns, test-driven development, and Extreme Programming. Currently affiliated with Three Rivers Institute and Agitar Software, he is the author of many Addison-Wesley titles, including Test-Driven Development (2003) and, with Cynthia Andres, Extreme Programming Explained, Second Edition (2005).

Table of Contents

Prefacep. xv
Acknowledgmentsp. xvi
Introductionp. 1
Tour Guidep. 3
And Now...p. 4
Patternsp. 5
A Theory of Programmingp. 9
Valuesp. 10
Communicationp. 10
Simplicityp. 11
Flexibilityp. 12
Principlesp. 13
Local Consequencesp. 13
Minimize Repetitionp. 14
Logic and Data Togetherp. 14
Symmetryp. 15
Declarative Expressionp. 16
Rate of Changep. 17
Conclusionp. 18
Motivationp. 19
Classp. 21
Classp. 22
Simple Superclass Namep. 23
Qualified Subclass Namep. 24
Abstract Interfacep. 24
Interfacep. 26
Abstract Classp. 26
Versioned Interfacep. 27
Value Objectp. 28
Specializationp. 31
Subclassp. 32
Implementorp. 34
Inner Classp. 34
Instance-Specific Behaviorp. 36
Conditionalp. 36
Delegationp. 38
Pluggable Selectorp. 40
Anonymous Inner Classp. 41
Library Classp. 41
Conclusionp. 42
Statep. 43
Statep. 44
Accessp. 45
Direct Accessp. 46
Indirect Accessp. 47
Common Statep. 47
Variable Statep. 48
Extrinsic Statep. 50
Variablep. 50
Local Variablep. 51
Fieldp. 52
Parameterp. 53
Collecting Parameterp. 55
Optional Parameterp. 56
Var Argsp. 56
Parameter Objectp. 57
Constantp. 58
Role-Suggesting Namep. 58
Declared Typep. 60
Initializationp. 61
Eager Initializationp. 61
Lazy Initializationp. 62
Conclusionp. 62
Behaviorp. 63
Control Flowp. 64
Main Flowp. 64
Messagep. 65
Choosing Messagep. 65
Double Dispatchp. 66
Decomposing (Sequencing) Messagep. 67
Reversing Messagep. 67
Inviting Messagep. 68
Explaining Messagep. 69
Exceptional Flowp. 70
Guard Clausep. 70
Exceptionp. 72
Checked Exceptionsp. 72
Exception Propagationp. 73
Conclusionp. 73
Methodsp. 75
Composed Methodp. 77
Intention-Revealing Namep. 79
Method Visibilityp. 80
Method Objectp. 82
Overridden Methodp. 83
Overloaded Methodp. 83
Method Return Typep. 84
Method Commentp. 85
Helper Methodp. 85
Debug Print Methodp. 86
Conversionp. 87
Conversion Methodp. 87
Conversion Constructorp. 88
Creationp. 88
Complete Constructorp. 89
Factory Methodp. 90
Internal Factoryp. 91
Collection Accessor Methodp. 91
Boolean Setting Methodp. 93
Query Methodp. 93
Equality Methodp. 94
Getting Methodp. 95
Setting Methodp. 96
Safe Copyp. 97
Conclusionp. 98
Collectionsp. 99
Metaphorsp. 100
Issuesp. 101
Interfacesp. 103
Arrayp. 103
Iterablep. 104
Collectionp. 104
Listp. 104
Setp. 105
SortedSetp. 105
Mapp. 106
Implementationsp. 107
Collectionp. 108
Listp. 108
Setp. 108
Mapp. 109
Collectionsp. 110
Searchingp. 111
Sortingp. 112
Unmodifiable Collectionsp. 113
Single-Element Collectionsp. 114
Empty Collectionsp. 114
Extending Collectionsp. 114
Conclusionp. 115
Evolving Frameworksp. 117
Changing Frameworks without Changing Applicationsp. 117
Incompatible Upgradesp. 118
Encouraging Compatible Changep. 120
Library Classp. 121
Objectsp. 121
Conclusionp. 129
Performance Measurementp. 131
Examplep. 131
APIp. 132
Implementationp. 133
MethodTimerp. 134
Canceling Overheadp. 136
Testsp. 136
Comparing Collectionsp. 137
Comparing ArrayList and LinkedListp. 139
Comparing Setsp. 140
Comparing Mapsp. 141
Conclusionp. 142
Bibliographyp. 145
General Programmingp. 145
Philosophyp. 147
Javap. 148
Indexp. 149
Table of Contents provided by Ingram. All Rights Reserved.


This is a book about programmingspecifically, about programming so other people can understand your code. There is no magic to writing code other people can read. It's like all writingknow your audience, have a clear overall structure in mind, express the details so they contribute to the whole story. Java offers some good ways to communicate. The implementation patterns here are Java programming habits that result in readable code. Another way to look at implementation patterns is as a way of thinking "What do I want to tell a reader about this code?" Programmers spend so much of their time in their own heads that trying to look at the world from someone else's viewpoint is a big shift. Not just "What will the computer do with this code?" but "How can I communicate what I am thinking to people?" This shift in perspective is healthy and potentially profitable, since so much software development money is spent on understanding existing code. There is an American game show called Jeopardy in which the host supplies answers and the contestants try to guess the questions. "A word describing being thrown through a window." "What is 'defenestration'?" "Correct." Coding is like Jeopardy. Java provides answers in the form of its basic constructs. Programmers usually have to figure out for themselves what the questions are, what problems are solved by each language construct. If the answer is "Declare a field as a Set ." the question might be "How can I tell other programmers that a collection contains no duplicates?" The implementation patterns provide a catalog of the common problems in programming and the features of Java that address those problems. Scope management is as important in book writing as it is in software development. Here are some things this book is not. It is not a style guide because it contains too much explanation and leaves the final decisions up to the reader. It is not a design book because it is mostly concerned with smaller-scale decisions, the kind programmers make many times a day. It's not a patterns book because the format of the patterns is idiosyncratic andad hoc(literally "built for a particular purpose"). It's not a language book because, while it covers many Java language features, it assumes readers already know Java. Actually this book is built on a rather fragile premise: that good code matters. I have seen too much ugly code make too much money to believe that quality of code is either necessary or sufficient for commercial success or widespread use. However, I still believe that quality of code matters even if it doesn't provide control over the future. Businesses that are able to develop and release with confidence, shift direction in response to opportunities and competition, and maintain positive morale through challenges and setbacks will tend to be more successful than businesses with shoddy, buggy code. Even if there was no long-term economic impact from careful coding I would still choose to write the best code I could. A seventy-year lifespan contains just over two billion seconds. That's not enough seconds to waste on work I'm not proud of. Coding well is satisfying, both the act itself and the knowledge that others will be able to understand, appreciate, use, and extend my work. In the end, then, this is a book about responsibility. As a programmer you have been given time, talent, money, and opportunity. What will you do to make responsible use of these gifts? The pages that follow contain my answer to this question for me: code for others as well as myself and my buddy the CPU.

Rewards Program

Write a Review