Implementation Patterns / Edition 1

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $22.22
Usually ships in 1-2 business days
(Save 55%)
Other sellers (Paperback)
  • All (12) from $22.22   
  • New (7) from $31.83   
  • Used (5) from $22.22   

Overview

“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.

Read More Show Less

Editorial Reviews

From Barnes & Noble
When you write software, you're not just interacting with operating systems and hardware: You're conversing with everyone who'll ever maintain or extend your code. Programmers who know how to communicate their intentions can create software that's far more successful throughout its entire lifecycle. Whether you realize it or not, you're constantly making decisions that impact how well your code communicates: all day long, sometimes even every minute. Kent Beck's Implementation Patterns will help you make those decisions far more effectively.

Beck has identified no less than 77 new patterns for making sure other humans know exactly what you're after: patterns for creating classes and methods, managing state, controlling program flow, even working with collections and frameworks.

For instance: What's the best way to communicate instance-specific behavior related to a class? When should you declare local variables? How do you clearly express your program's main flow of control, as well as less-frequently-used "exceptional flows"? How do you compose methods that are easier to understand, and when is it appropriate to override or overload methods? How can you take advantage of frameworks without locking yourself in more than necessary?

As you'd expect from the widely admired Kent Beck (Extreme Programming), each pattern is explained clearly and thoughtfully. You'll find plenty of Java examples, too: nothing too fancy for its own good, all of it extremely accessible to virtually any Java programmer.

Any professional writer will tell you that you don't really understand a topic until you try to explain it in writing. Even if, somehow, nobody ever sees your code, Beck's patterns will help you gain a far deeper understanding of what you're trying to accomplish -- so you can write better code from day one. Bill Camarda, from the February 2008 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780321413093
  • Publisher: Addison-Wesley
  • Publication date: 11/16/2007
  • Series: Addison-Wesley Signature Series
  • Edition description: New Edition
  • Edition number: 1
  • Pages: 157
  • Product dimensions: 7.10 (w) x 9.28 (h) x 0.45 (d)

Meet the Author

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).
Read More Show Less

Read an Excerpt

This is a book about programming—specifically, about programming so other people can understand your code. There is no magic to writing code other people can read. It’s like all writing—know 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 and ad 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.

Read More Show Less

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

Read More Show Less

Preface

This is a book about programming—specifically, about programming so other people can understand your code. There is no magic to writing code other people can read. It’s like all writing—know 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 and ad 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.

Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star

(1)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted October 31, 2008

    No text was provided for this review.

Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)