Clean Code
Subtitle: A Handbook of Agile Software Craftsmanship
Publisher: Prentice Hall
Published: July 2008
Language: eng
Format: Taschenbuch
Number of pages: 431
ISBN-13: 9780132350884
Description: Even bad code can function. But if code isn't clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn't have to be that way.

Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship . Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code on the fly into a book that will instill within you the values of a software craftsman and make you a better programmer but only if you work at it.

What kind of work will you be doing? You'll be reading code - lots of code. And you will be challenged to think about what's right about that code, and what's wrong with it. More importantly, you will be challenged to reassess your professional values and your commitment to your craft.

Clean Code is divided into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up code - of transforming a code base that has some problems into one that is sound and efficient. The third part is the payoff: a single chapter containing a list of heuristics and "smells" gathered while creating the case studies. The result is a knowledge base that describes the way we think when we write, read, and clean code.

Readers will come away from this book understanding

 - How to tell the difference between good and bad code
 - How to write good code and how to transform bad code into good code
 - How to create good names, good functions, good objects, and good classes
 - How to format code for maximum readability
 - How to implement complete error handling without obscuring code logic
 - How to unit test and practice test-driven development

This book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.
Table of contents: title: Foreword
pagenum: xix; title: Introduction
pagenum: xxv; title: On the Cover
pagenum: xxix; label: Chapter 1
title: Clean Code
pagenum: 1; title: There Will Be Code
pagenum: 2; title: Bad Code
pagenum: 3; title: The Total Cost of Owning a Mess
pagenum: 4; title: The Grand Redesign in the Sky
pagenum: 5; title: Attitude
pagenum: 5; title: The Primal Conundrum
pagenum: 6; title: The Art of Clean Code?
pagenum: 6; title: What Is Clean Code?
pagenum: 7; title: Schools of Thought
pagenum: 12; title: We Are Authors
pagenum: 13; title: The Boy Scout Rule
pagenum: 14; title: Prequel and Principles
pagenum: 15; title: Conclusion
pagenum: 15; title: Bibliography
pagenum: 15; label: Chapter 2
title: Meaningful Names
pagenum: 17; title: A Introduction
pagenum: 17; title: Use Intention-Revealing Names
pagenum: 18; title: Avoid Disinformation
pagenum: 19; title: Make Meaningful Distinctions
pagenum: 20; title: Use Pronounceable Names
pagenum: 21; title: Use Searchable Names
pagenum: 22; title: Avoid Encodings
pagenum: 23; title: Hungarian Notation
pagenum: 23; title: Member Prefixes
pagenum: 24; title: Interfaces and Implementations
pagenum: 24; title: Avoid Mental Mapping
pagenum: 25; title: Class Names
pagenum: 25; title: Method Names
pagenum: 25; title: Don't Be Cute
pagenum: 26; title: Pick One Word per Concept
pagenum: 26; title: Don't Pun
pagenum: 26; title: Use Solution Domain Names
pagenum: 27; title: Use Problem Domain Names
pagenum: 27; title: Add Meaningful Context
pagenum: 27; title: Don't Add Gratuitous Context
pagenum: 29; title: Final Words
pagenum: 30; label: Chapter 3
title: Functions
pagenum: 31; title: Small!
pagenum: 34; title: Blocks and Indenting
pagenum: 35; title: Do One Thing
pagenum: 35; title: Sections within Functions
pagenum: 36; title: One Level of Abstraction per Function
pagenum: 36; title: Reading Code from Top to Bottom: The Stepdown Rule
pagenum: 37; title: Switch Statements
pagenum: 37; title: Use Descriptive Names
pagenum: 39; title: Function Arguments
pagenum: 40; title: Common Monadic Forms
pagenum: 41; title: Flag Arguments
pagenum: 41; title: Dyadic Functions
pagenum: 42; title: Triads
pagenum: 42; title: Argument Objects
pagenum: 43; title: Argument Lists
pagenum: 43; title: Verbs and Keywords
pagenum: 43; title: Have No Side Effects
pagenum: 44; title: Output Arguments
pagenum: 45; title: Command Query Separation
pagenum: 45; title: Prefer Exceptions to Returning Error Codes
pagenum: 46; title: Extract Try/Catch Blocks
pagenum: 46; title: Error Handling Is One Thing
pagenum: 47; title: The Error.java Dependency Magnet
pagenum: 47; title: Don't Repeat Yourself
pagenum: 48; title: Structured Programming
pagenum: 48; title: How Do You Write Functions Like This?
pagenum: 49; title: Conclusion
pagenum: 49; title: SetupTeardownIncluder
pagenum: 50; title: Bibliography
pagenum: 52; label: Chapter 4
title: Comments
pagenum: 53; title: Comments Do Not Make Up for Bad Code
pagenum: 55; title: Explain Yourself in Code
pagenum: 55; title: Good Comments
pagenum: 55; title: Legal Comments
pagenum: 55; title: Informative Comments
pagenum: 56; title: Explanation of Intent
pagenum: 56; title: Clarification
pagenum: 57; title: Warning of Consequences
pagenum: 58; title: TODO Comments
pagenum: 58; title: Amplification
pagenum: 59; title: Javadocs in Public APIs
pagenum: 59; title: Bad Comments
pagenum: 59; title: Mumbling
pagenum: 59; title: Redundant Comments
pagenum: 60; title: Misleading Comments
pagenum: 63; title: Mandated Comments
pagenum: 63; title: Journal Comments
pagenum: 63; title: Noise Comments
pagenum: 64; title: Scary Noise
pagenum: 66; title: Don't Use a Comment When You Can Use a Function or a Variable
pagenum: 67; title: Position Markers
pagenum: 67; title: Closing Brace Comments
pagenum: 67; title: Attributions and Bylines
pagenum: 68; title: Commented-Out Code
pagenum: 68; title: HTML Comments
pagenum: 69; title: Nonlocal Information
pagenum: 69; title: Too Much Information
pagenum: 70; title: Inobvious Connection
pagenum: 70; title: Function Headers
pagenum: 70; title: Javadocs in Nonpublic Code
pagenum: 71; title: Example
pagenum: 71; title: Bibliography
pagenum: 74; label: Chapter 5
title: Formatting
pagenum: 75; title: The Purpose of Formatting
pagenum: 76; title: Vertical Formatting
pagenum: 76; title: The Newspaper Metaphor
pagenum: 77; title: Vertical Openness Between Concepts
pagenum: 78; title: Vertical Density
pagenum: 79; title: Vertical Distance
pagenum: 80; title: Vertical Ordering
pagenum: 84; title: Horizontal Formatting
pagenum: 85; title: Horizontal Openness and Density
pagenum: 86; title: Horizontal Alignment
pagenum: 87; title: Indentation
pagenum: 88; title: Dummy Scopes
pagenum: 90; title: Team Rules
pagenum: 90; title: Uncle Bob's Formatting Rules
pagenum: 90; label: Chapter 6
title: Objects and Data Structures
pagenum: 93; title: Data Abstraction
pagenum: 93; title: Data/Object Anti-Symmetry
pagenum: 95; title: The Law of Demeter
pagenum: 97; title: Train Wrecks
pagenum: 98; title: Hybrids
pagenum: 99; title: Hiding Structure
pagenum: 99; title: Data Transfer Objects
pagenum: 100; title: Active Record
pagenum: 101; title: Conclusion
pagenum: 101; title: Bibliography
pagenum: 101; label: Chapter 7
title: Error Handling
pagenum: 103; title: Use Exceptions Rather Than Return Codes
pagenum: 104; title: Write Your Try-Catch-Finally Statement First
pagenum: 105; title: Use Unchecked Exceptions
pagenum: 106; title: Provide Context with Exceptions
pagenum: 107; title: Define Exception Classes in Terms of a Caller's Needs
pagenum: 107; title: Define the Normal Flow
pagenum: 109; title: Don't Return Null
pagenum: 110; title: Don't Pass Null
pagenum: 111; title: Conclusion
pagenum: 112; title: Bibliography
pagenum: 112; label: Chapter 8
title: Boundaries
pagenum: 113; title: Using Third-Party Code
pagenum: 114; title: Exploring and Learning Boundaries
pagenum: 116; title: Learning log4j
pagenum: 116; title: Learning Tests Are Better Than Free
pagenum: 118; title: Using Code That Does Not Yet Exist
pagenum: 118; title: Clean Boundaries
pagenum: 120; title: Bibliography
pagenum: 120; label: Chapter 9
title: Unit Tests
pagenum: 121; title: The Three Laws of TDD
pagenum: 122; title: Keeping Tests Clean
pagenum: 123; title: Tests Enable the -ilities
pagenum: 124; title: Clean Tests
pagenum: 124; title: Domain-Specific Testing Language
pagenum: 127; title: A Dual Standard
pagenum: 127; title: One Assert per Test
pagenum: 130; title: Single Concept per Test
pagenum: 131; title: F.I.R.S.T.
pagenum: 132; title: Conclusion
pagenum: 133; title: Bibliography
pagenum: 133; label: Chapter 10
title: Classes
pagenum: 135; title: Class Organization
pagenum: 136; title: Encapsulation
pagenum: 136; title: Classes Should Be Small!
pagenum: 138; title: The Single Responsibility Principle
pagenum: 138; title: Cohesion
pagenum: 140; title: Maintaining Cohesion Results in Many Small Classes
pagenum: 141; title: Organizing for Change
pagenum: 147; title: Isolating from Change
pagenum: 149; title: Bibliography
pagenum: 151; label: Chapter 11
title: Systems
pagenum: 153; title: How Would You Build a City?
pagenum: 154; title: Separate Constructing a System from Using It
pagenum: 154; title: Separation of Main
pagenum: 155; title: Factories
pagenum: 155; title: Dependency Injection
pagenum: 157; title: Scaling Up
pagenum: 157; title: Cross-Cutting Concerns
pagenum: 160; title: Java Proxies
pagenum: 161; title: Pure Java AOP Frameworks
pagenum: 163; title: AspectJ Aspects
pagenum: 166; title: Test Drive the System Architecture
pagenum: 166; title: Optimize Decision Making
pagenum: 167; title: Use Standards Wisely, When They Add Demonstrable Value
pagenum: 168; title: Systems Need Domain-Specific Languages
pagenum: 168; title: Conclusion
pagenum: 169; title: Bibliography
pagenum: 169; label: Chapter 12
title: Emergence
pagenum: 171; title: Getting Clean via Emergent Design
pagenum: 171; title: Simple Design Rule 1: Runs All the Tests
pagenum: 172; title: Simple Design Rules 2-4: Refactoring
pagenum: 172; title: No Duplication
pagenum: 173; title: Expressive
pagenum: 175; title: Minimal Classes and Methods
pagenum: 176; title: Conclusion
pagenum: 176; title: Bibliography
pagenum: 176; label: Chapter 13
title: Concurrency
pagenum: 177; title: Why Concurrency?
pagenum: 178; title: Myths and Misconceptions
pagenum: 179; title: Challenges
pagenum: 180; title: Concurrency Defense Principles
pagenum: 180; title: Single Responsibility Principle
pagenum: 181; title: Corollary: Limit the Scope of Data
pagenum: 181; title: Corollary: Use Copies of Data
pagenum: 181; title: Corollary: Threads Should Be as Independent as Possible
pagenum: 182; title: Know Your Library
pagenum: 182; title: Thread-Safe Collections
pagenum: 182; title: Know Your Execution Models
pagenum: 183; title: Producer-Consumer
pagenum: 184; title: Readers-Writers
pagenum: 184; title: Dining Philosophers
pagenum: 184; title: Beware Dependencies Between Synchronized Methods
pagenum: 185; title: Keep Synchronized Sections Small
pagenum: 185; title: Writing Correct Shut-Down Code Is Hard
pagenum: 186; title: Testing Threaded Code
pagenum: 186; title: Treat Spurious Failures as Candidate Threading Issues
pagenum: 187; title: Get Your Nonthreaded Code Working First
pagenum: 187; title: Make Your Threaded Code Pluggable
pagenum: 187; title: Make Your Threaded Code Tunable
pagenum: 187; title: Run with More Threads Than Processors
pagenum: 188; title: Run on Different Platforms
pagenum: 188; title: Instrument Your Code to Try and Force Failures
pagenum: 188; title: Hand-Coded
pagenum: 189; title: Automated
pagenum: 189; title: Conclusion
pagenum: 190; title: Bibliography
pagenum: 191; label: Chapter 14
title: Successive Refinement
pagenum: 193; title: Args Implementation
pagenum: 194; title: How Did I Do This?
pagenum: 200; title: Args: The Rough Draft
pagenum: 201; title: So I Stopped
pagenum: 212; title: On Incrementalism
pagenum: 212; title: String Arguments
pagenum: 214; title: Conclusion
pagenum: 250; label: Chapter 15
title: JUnit Internals
pagenum: 251; title: The JUnit Framework
pagenum: 252; title: Conclusion
pagenum: 265; label: Chapter 16
title: Refactoring SerialDate
pagenum: 267; title: First, Make It Work
pagenum: 268; title: Then Make It Right
pagenum: 270; title: Conclusion
pagenum: 284; title: Bibliography
pagenum: 284; label: Chapter 17
title: Smells and Heuristics
pagenum: 285; title: Comments
pagenum: 286; label: C1
title: Inappropriate Information
pagenum: 286; label: C2
title: Obsolete Comment
pagenum: 286; label: C3
title: Redundant Comment
pagenum: 286; label: C4
title: Poorly Written Comment
pagenum: 287; label: C5
title: Commented-Out Code
pagenum: 287; title: Environment
pagenum: 287; label: E1
title: Build Requires More Than One Step
pagenum: 287; label: E2
title: Tests Require More Than One Step
pagenum: 287; title: Functions
pagenum: 288; label: F1
title: Too Many Arguments
pagenum: 288; label: F2
title: Output Arguments
pagenum: 288; label: F3
title: Flag Arguments
pagenum: 288; label: F4
title: Dead Function
pagenum: 288; title: General
pagenum: 288; label: G1
title: Multiple Languages in One Source File
pagenum: 288; label: G2
title: Obvious Behavior Is Unimplemented
pagenum: 288; label: G3
title: Incorrect Behavior at the Boundaries
pagenum: 289; label: G4
title: Overridden Safeties
pagenum: 289; label: G5
title: Duplication
pagenum: 289; label: G6
title: Code at Wrong Level of Abstraction
pagenum: 290; label: G7
title: Base Classes Depending on Their Derivatives
pagenum: 291; label: G8
title: Too Much Information
pagenum: 291; label: G9
title: Dead Code
pagenum: 292; label: G10
title: Vertical Separation
pagenum: 292; label: G11
title: Inconsistency
pagenum: 292; label: G12
title: Clutter
pagenum: 293; label: G13
title: Artificial Coupling
pagenum: 293; label: G14
title: Feature Envy
pagenum: 293; label: G15
title: Selector Arguments
pagenum: 294; label: G16
title: Obscured Intent
pagenum: 295; label: G17
title: Misplaced Responsibility
pagenum: 295; label: G18
title: Inappropriate Static
pagenum: 296; label: G19
title: Use Explanatory Variables
pagenum: 296; label: G20
title: Function Names Should Say What They Do
pagenum: 297; label: G21
title: Understand the Algorithm
pagenum: 297; label: G22
title: Make Logical Dependencies Physical
pagenum: 298; label: G23
title: Prefer Polymorphism to If/Else or Switch/Case
pagenum: 299; label: G24
title: Follow Standard Conventions
pagenum: 299; label: G25
title: Replace Magic Numbers with Named Constants
pagenum: 300; label: G26
title: Be Precise
pagenum: 301; label: G27
title: Structure over Convention
pagenum: 301; label: G28
title: Encapsulate Conditionals
pagenum: 301; label: G29
title: Avoid Negative Conditionals
pagenum: 302; label: G30
title: Functions Should Do One Thing
pagenum: 302; label: G31
title: Hidden Temporal Couplings
pagenum: 302; label: G32
title: Don't Be Arbitrary
pagenum: 303; label: G33
title: Encapsulate Boundary Conditions
pagenum: 304; label: G34
title: Functions Should Descend Only One Level of Abstraction
pagenum: 304; label: G35
title: Keep Configurable Data at High Levels
pagenum: 306; label: G36
title: Avoid Transitive Navigation
pagenum: 306; title: Java
pagenum: 307; label: J1
title: Avoid Long Import Lists by Using Wildcards
pagenum: 307; label: J2
title: Don't Inherit Constants
pagenum: 307; label: J3
title: Constants versus Enums
pagenum: 308; title: Names
pagenum: 309; label: N1
title: Choose Descriptive Names
pagenum: 309; label: N2
title: Choose Names at the Appropriate Level of Abstraction
pagenum: 311; label: N3
title: Use Standard Nomenclature Where Possible
pagenum: 311; label: N4
title: Unambiguous Names
pagenum: 312; label: N5
title: Use Long Names for Long Scopes
pagenum: 312; label: N6
title: Avoid Encodings
pagenum: 312; label: N7
title: Names Should Describe Side-Effects
pagenum: 313; title: Tests
pagenum: 313; label: T1
title: Insufficient Tests
pagenum: 313; label: T2
title: Use a Coverage Tool!
pagenum: 313; label: T3
title: Don't Skip Trivial Tests
pagenum: 313; label: T4
title: An Ignored Test Is a Question About an Ambiguity
pagenum: 313; label: T5
title: Test Boundary Conditions
pagenum: 314; label: T6
title: Exhaustively Test Near Bugs
pagenum: 314; label: T7
title: Patterns of Failure Are Revealing
pagenum: 314; label: T8
title: Test Coverage Patterns Can Be Revealing
pagenum: 314; label: T9
title: Tests Should Be Fast
pagenum: 314; title: Conclusion
pagenum: 314; title: Bibliography
pagenum: 315; label: Appendix A
title: Concurrency
pagenum: 317; title: Client/Server Example
pagenum: 317; title: The Server
pagenum: 317; title: Adding Threading
pagenum: 319; title: Server Observations
pagenum: 319; title: Conclusion
pagenum: 321; title: Possible Paths of Execution
pagenum: 321; title: Number of Paths
pagenum: 322; title: Digging Deeper
pagenum: 323; title: Conclusion
pagenum: 326; title: Knowing Your Library
pagenum: 326; title: Executor Framework
pagenum: 326; title: Nonblocking Solutions
pagenum: 327; title: Nonthread-Safe Classes
pagenum: 328; title: Dependencies Between Methods Can Break Concurrent Code
pagenum: 329; title: Tolerate the Failure
pagenum: 330; title: Client-Based Locking
pagenum: 330; title: Server-Based Locking
pagenum: 332; title: Increasing Throughput
pagenum: 333; title: Single-Thread Calculation of Throughput
pagenum: 334; title: Multithread Calculation of Throughput
pagenum: 335; title: Deadlock
pagenum: 335; title: Mutual Exclusion
pagenum: 336; title: Lock & Wait
pagenum: 337; title: No Preemption
pagenum: 337; title: Circular Wait
pagenum: 337; title: Breaking Mutual Exclusion
pagenum: 337; title: Breaking Lock & Wait
pagenum: 338; title: Breaking Preemption
pagenum: 338; title: Breaking Circular Wait
pagenum: 338; title: Testing Multithreaded Code
pagenum: 339; title: Tool Support for Testing Thread-Based Code
pagenum: 342; title: Conclusion
pagenum: 342; title: Tutorial: Full Code Examples
pagenum: 343; title: Client/Server Nonthreaded
pagenum: 343; title: Client/Server Using Threads
pagenum: 347; label: Appendix B
title: org.jfree.date.SerialDate
pagenum: 349; label: Appendix C
title: Cross References of Heuristics
pagenum: 409; title: Epilogue
pagenum: 411; title: Index
pagenum: 413