万本电子书0元读

万本电子书0元读

顶部广告

Agile Technical Practices Distilled电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Santos Pedro M.,Consolaro Marco,Di Gioia Alessandro

出  版  社:Packt Publishing

出版时间:2019-06-28

字       数:1742.8万

所属分类: 进口书 > 外文原版书 > 小说

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Delve deep into the various technical practices, principles, and values of Agile. Key Features ?Discover the essence of Agile software development and the key principles of software design ?Explore the fundamental practices of Agile working, including test-driven development (TDD), refactoring, pair programming, and continuous integration ?Learn and apply the four elements of simple design Book Description The number of popular technical practices has grown exponentially in the last few years. Learning the common fundamental software development practices can help you become a better programmer. This book uses the term Agile as a wide umbrella and covers Agile principles and practices, as well as most methodologies associated with it. You’ll begin by discovering how driver-navigator, chess clock, and other techniques used in the pair programming approach introduce discipline while writing code. You’ll then learn to safely change the design of your code using refactoring. While learning these techniques, you’ll also explore various best practices to write efficient tests. The concluding chapters of the book delve deep into the SOLID principles - the five design principles that you can use to make your software more understandable, flexible and maintainable. By the end of the book, you will have discovered new ideas for improving your software design skills, the relationship within your team, and the way your business works. What you will learn ?Apply the red, green, refactor cycle of TDD to solve procedural problems ?Implement the various techniques used in the pair programming approach ?Use code smells as feedback ?Test your production code using mocks and stubs ?Refactor legacy code to bring it in line with modern Agile standards ?Apply the object calisthenics ruleset to enhance your software design Who this book is for This book is designed for software developers looking to improve their technical practices. Software coaches may also find it helpful as a teaching reference manual. This is not a beginner's book on how to program. You must be comfortable with at least one programming language and must be able to write unit tests using any unit testing framework. Table of Contents 1.Pair Programming 2.Classic TDD I – Test-Driven Development 3.Classic TDD II 4.Classic TDD III – Transformation Priority Premise 5.Design I – Object Calisthenics 6.Design II – Refactoring 7.Design III – Code Smells 8.Test Doubles 9.Testing Legacy Code 10.Design Patterns 11.Cohesion and Coupling 12.Solid Principles ++ 13.Design VII – Connascence 14.The Four Elements of Simple Design 15.Outside-In Development 16.Behavior-Driven Development 17.Understand the Business 18.The Story of Team C 19.Conclusion 20.The 12 Agile Principles 21.PopcornFlow by Claudio Perrone 22.EventStorming by Alberto Brandolini 23.License: CyberDojo 24.Sample Solutions
目录展开

Agile Technical Practices Distilled

Agile Technical Practices Distilled

Table of Contents

Preface i

Section 1: First Steps 1

Chapter 1: Pair Programming 3

What is Pair Programming? 4

Roles 5

Driver/Navigator Switch Techniques 5

Chess Clock 5

Ping Pong/Popcorn 5

Breaks 7

Pomodoro 7

Katas 8

When Should I Move to the Next Lesson? 8

Resources 8

Web 8

Chapter 2: Classic TDD I – Test-Driven Development 11

Classic TDD 12

The Three Laws of TDD 12

1. You Are Not Allowed to Write Any More of a Unit Test That Is Sufficient to Fail, and Compilation Failures Are Failures 13

2. You Are Not Allowed to Write Any Production Code Unless It Is to Make a Failing Unit Test Pass 13

3. You Are Not Allowed to Write Any More Production Code That Is Sufficient to Pass the One Failing Unit Test 13

Refactoring and the Rule of Three – Baby Steps 14

Three Methods of Moving Forward in TDD 15

From Red to Green 15

Degrees of Freedom 15

Naming Tests 16

A Test Name Pattern 17

Katas 18

Fizz Buzz by cyber-dojo 18

Fizz Buzz Kata Summary 20

More Katas 20

Leap Year by cyber-dojo 20

Nth Fibonacci by cyber-dojo 21

Great Habits 21

Considerations when Writing a New Test 21

Considerations When Making a Failing Test Pass 22

Considerations After the Test Passes 22

Classic TDD Flow 22

Where are We in the Big Picture of Object-Oriented (OO) Software Design? 24

When Should I Move to the Next Lesson? 24

Resources 25

Web 25

Books 25

Chapter 3: Classic TDD II 27

Writing the Assertion First and Working Backward 27

Organizing Your Test in Arrange, Act, and Assert Blocks 28

Benefits of Organizing Tests in Arrange, Act, and Assert Blocks 29

Unit Test Principles 29

Katas 30

Stats Calculator by cyber-dojo 30

Anagrams by cyber-dojo 30

Great Habits 31

Considerations when Writing a New Test 31

Considerations when Making a Failing Test Pass 32

Considerations after the Test Passes 32

Classic TDD Flow 33

Where are we in the Big Picture of Object-Oriented (OO) Software Design? 34

When Should I Move to the Next Lesson? 35

Resources 35

Web 35

Books 35

Chapter 4: Classic TDD III – Transformation Priority Premise 37

Kata 38

Roman Numerals by cyber-dojo 38

TPP – Defining Obvious Implementation 39

TPP Table 40

The Transformations 41

Transformation 1 – {} -> Nil 41

Transformation 2 – Nil -> Constant 41

Transformation 3 – Constant -> Constant+ 41

Transformation 4 – Constant -> Scalar 41

Transformation 5 – Statement -> Statements 41

Transformation 6 – Unconditional -> Conditional 41

Transformation 7 – Scalar -> Array 42

Transformation 8 – Array -> Container 42

Transformation 9 – Statement -> Tail Recursion 42

Transformation 10 – If -> Loop 42

Transformation 11 – Statement -> Recursion 42

Transformation 12 – Expression -> Function 42

Transformation 13 – Variable -> Mutation 43

Example Using the TPP on the Fibonacci Sequence 43

Katas 44

Roman Numerals by cyber-dojo 44

Prime Factors by cyber-dojo 44

Boolean Calculator by Alessandro Di Gioia 45

Great Habits 47

Considerations when Writing a New Test 47

Considerations when Making a Failing Test Pass 47

Considerations after the Test Passes 47

Classic TDD flow 48

Where are We in the Big Picture of Object-Oriented (OO) Software Design? 49

When Should I Move to the Next Lesson? 50

Resources 50

Web 50

Chapter 5: Design 1 – Object Calisthenics 53

It's the Design... 54

Kata 54

Tic-Tac-Toe 54

Object Calisthenics – 10 Steps to Better Software Design 55

Only One Level of Indentation per Method 56

Don't Use the ELSE Keyword 56

Wrap All Primitives and Strings 56

First-Class Collections 57

No Getters/Setters/Properties 58

Wrap All Primitives and Strings 60

One Dot per Line 61

Don't Abbreviate 61

Keep All Entities Small 61

No Classes with More Than Two Instance Variables 62

All Classes Must Have State 62

Heuristics 62

Katas 63

Tic-Tac-Toe 63

Game of Life 63

Great Habits 64

Considerations When Writing a New Test 64

Considerations When Making a Failing Test Pass 64

Considerations after the Test Passes 64

Classic TDD flow 65

Where Are We in the Big Picture of OO Software Design? 66

When Should I Move on to the Next Lesson? 67

Resources 67

Web 67

Section 2: Walking 69

Chapter 6: Design 2 – Refactoring 71

When to Refactor (For Now) 72

Main Refactors 72

IDE Agility (Know Your Shortcuts) 73

Kata 73

Refactoring Golf 73

Refactor 80-20 Rule 74

Refactoring Guidelines 75

Stay in the Green While Refactoring 75

Commit as Often as Possible 76

Refactor Readability before Design 76

Change Design (Simple Changes) 80

Kata 81

Tennis Refactoring by Emily Bache 81

Parallel Change (Or Expand, Migrate, and Contract) 82

Expand 82

Migrate 82

Contract 82

Kata 82

Parallel Change Kata by Pawel Duda and Carlos Blé 82

Great Habits 82

Considerations When Writing a New Test 83

Considerations When Making a Failing Test Pass 83

Considerations after the Test Passes 83

When Should I Move on to the Next Lesson? 84

Resources 84

Web 84

Books 84

Chapter 7: Design 3 – Code Smells 87

Design Smells 88

Code Smells 89

Bloaters 89

Couplers 90

Object-Orientation Abusers 90

Change Preventers 91

Dispensables 91

Highlighted Code Smells 92

Code Smells Hierarchy 92

Primitive Obsession 93

Feature Envy 93

Message Chains 94

Object Calisthenics Preventing Code Smells 95

When to Refactor (Extended for Code Smells) 96

Refactor Code Smells 96

Kata 98

Smelly Tic-Tac-Toe 98

Great Habits 98

Considerations When Writing a New Test 99

Considerations When Making a Failing Test Pass 99

Considerations After the Test Passes 99

Classic TDD Flow 100

The Big Picture 101

When Should I Move on to the Next Lesson? 102

Resources 102

Web 102

Books 102

Chapter 8: Test Doubles 105

Principles 106

Command-Query Separation 106

Queries 107

Commands 108

Different Types of Test Doubles 108

Dummy Objects 108

Stubs 108

Fake Objects 109

Mocks 109

Spies 109

Test Doubles Guidelines 109

Only Use Test Doubles for Classes That You Own 109

Verify as Little as Possible in a Test 110

Don't Use Test Doubles for Isolated Objects 111

Don't Add Behavior in Test Doubles 111

Only Use Test Doubles for Your Immediate Neighbors 113

Too Many Test Doubles 114

CQS Principle Trade-OffS 114

Katas 115

Character Copier by Urs Enzler 115

Instrument Processor by Urs Enzler 116

Great Habits 118

Considerations When Writing a New Test 118

Considerations When Making a Failing Test Pass 119

Considerations after the Test Passes 119

When Should I Move on to the Next Lesson? 119

Resources 120

Web 120

Books 120

Chapter 9: Testing Legacy Code 123

Breaking Dependencies Using a Seam 124

Using Inheritance to Decouple Production Code 124

Characterization Tests 126

Kata 126

Characterization Tests on Gilded Rose Kata by Emily Bache 126

Golden Master 127

Feasibility 127

Generate Input/Output (Golden Master) 127

Assert 128

Kata 128

Golden Master on Gilded Rose Kata by Emily Bache 128

Approval Tests by Llewellyn Falco 129

Combination Tests 129

Revisiting the Refactoring Guidelines 130

Stay in the Green while Refactoring 130

Kata 130

Gilded Rose Refactoring Kata by Emily Bache 130

Conclusions 130

Guideline Questions 130

Great Habits 131

Considerations when Writing a New Test 131

Considerations when Making a Failing Test Pass 132

Considerations after the Test Passes 132

When Should I Move to the Next Lesson? 132

Resources 133

Web 133

Books 133

Chapter 10: Design IV –Design Patterns 135

Design Pattern Advantages 136

Design Pattern Pitfalls 137

A Quick Reference Catalogue 137

Creational Design Patterns 137

Behavioral Design Patterns 138

Structural Design Patterns 140

Revisiting the Refactoring Guidelines 140

Refactoring Design 140

Kata 141

Refactoring Game of Life Kata to Patterns 141

Great Habits 141

Considerations When Writing a New Test 142

Considerations When Making a Failing Test Pass 142

Considerations After the Test Passes 142

When Should I Move to the Next Lesson? 143

Resources 143

Web 143

Books 143

Section 3: Running 145

Chapter 11: Design V – Cohesion and Coupling 147

Coupling 147

Types of Coupling 148

Interaction Coupling 148

Law of Demeter 150

Method Coupling Premises 151

Inheritance Coupling 151

Cohesion 152

Other Indicators of Possible Low Cohesion in Design 153

Types of Cohesion 153

Class Cohesion 154

Method Cohesion 155

Katas 156

Connecting Code Smells with Cohesion/Coupling 156

Connecting Object Calisthenics with Code Smells and Cohesion/Coupling 158

When to Refactor (Extended for Cohesion/Coupling) 159

Classic TDD Flow 160

The Big Picture 161

When Should I Move to the Next Lesson? 162

Resources 162

Web 162

Books 162

Chapter 12: Design VI – Solid Principles ++ 165

Single Responsibility Principle 165

Open/Closed Principle 167

Liskov Substitution Principle 171

Interface Segregation Principle 174

Dependency Inversion Principle 175

Balanced Abstraction Principle 178

Principle of Least Astonishment 180

Kata 181

Connecting Cohesion/Coupling and SOLID principles 181

When to Refactor (Extended for SOLID Principles) 182

Classic TDD Flow 182

The Big Picture 183

When Should I Move to the Next Lesson? 183

Resources 184

Web 184

Books 184

Chapter 13: Design VII – Connascence 187

Definition 187

Dimensions 189

Degree 189

Locality 189

Strength 189

Connascence of Name and Type (CoN and CoT) 190

Connascence of Position 192

Connascence of Value (CoV) 197

Connascence of Meaning 201

Connascence of Algorithm 203

Connascence of Execution Order 205

Connascence of Timing 209

Connascence of Identity 211

Connascence of Manual Task 213

Classic TDD Flow 214

The Big Picture 215

When Should I Move to the Next Lesson? 216

Resources 216

Web 216

Books 217

Chapter 14: Design VIII –The Four Elementsof Simple Design 219

What Are the Four Elements of Simple Design? 220

What Does Each Element Mean? 220

Passes Its Tests 220

Minimizes Duplication 221

Maximizes Clarity 221

Has Fewer Elements 222

Alternative Definitions of Simple Design 222

Definition #1 222

Definition #2 222

Definition #3 222

Definition #4 223

Definition #5 223

Definition #6 223

Our Personal Definitions of Simple Design 224

Pedro 224

Marco 224

Alessandro 224

Kata 224

Elevator Kata by Marco Consolaro 224

Classic TDD Flow 226

The Big Picture 227

When Should I Move to the Next Lesson? 228

Resources 228

Web 228

Books 228

Chapter 15: Conclusion 231

Cohesion and Coupling as Forces 233

The 3 Cs of Design: From Cohesion and Coupling to Connascence 233

Systems Entropy 236

The Relevance of Systems Entropy 237

Software Development as System Building 238

Good Design as a Low-Entropy System 238

The Big Picture 239

Resources 240

Web-based resources: 240

Books: 240

Section 4: Flying 243

Chapter 16: Outside-In Development 245

The Classic TDD Approach 247

Acceptance Tests 248

Acceptance Test Styles 250

Test Boundaries 251

Double Loop TDD 252

The Outside-In Approach 253

An Outside-In Mindset 253

Outside-In TDD: The London School 258

Example 260

The Direction of Dependencies 262

Should I Use Classic TDD or Outside-In TDD? 264

Kata 264

Stock Portfolio 264

Katacombs of Shoreditch by Marco Consolaro 265

Part I 266

PART II 267

The Big Picture 269

Great Habits 270

Considerations When Writing a New Test 270

Considerations When Making a Failing Test Pass 270

Considerations After the Test Has Passed 271

Resources 271

Web-based resources: 271

Books: 271

Chapter 17: Behavior-Driven Development 273

Poka-Yoke 274

Mistakes versus Defects: Feedback Is the Cure (Again) 275

Bugs and Communication 276

User Stories 278

Behavior-Driven Development 279

The Structure of a Story 279

Acceptance Criteria: It's All about the Examples 280

From Criteria to Acceptance Tests 281

Acceptance Tests Done Right 281

Readable by Business Folks 282

Feature Complete 285

Fast 286

Boundaries 286

The Walking Skeleton 287

Kata 287

The Messy Delivery Office Requirements 287

Resources 288

Web-based resources 288

Books 289

Chapter 18: Understand the Business 291

Knowledge versus Understanding 292

Theory of Constraints 294

Domain-Driven Design: What Domain? 296

Beyond Requirements: Knowledge Crunching 297

5 Whys 298

Impact Mapping 300

PopcornFlow 302

User Story Mapping 303

EventStorming 304

Business Model Canvas 305

Value Streams and Domain Events 307

Bounded Contexts and Communication 310

Synchronous versus Asynchronous 313

Command-Query Separation 314

Business and DevOps 316

The First Way 316

The Second Way 317

The Third Way 318

Systems Thinking and Sociotechnical Organizations 319

Resources 320

Web-based resources 320

Books 321

Chapter 19: Story of Team C 325

Terraforming 326

Team Building 327

The Backlog: Crunching Knowledge for Breakfast 328

Cracking On 329

From Forming to Performing 330

Outside-In ATDD with Optional Unit Tests 330

The Green Flag 331

The Moral of the Story 332

Chapter 20: Conclusion 335

The Human Factor 337

Team Play 338

Bounded Rationality and Knowledge Sharing 340

Resources 341

Web 341

Books 341

Chapter 21: The 12 Agile Principles 343

Chapter 22: PopcornFlow by Claudio Perrone 347

The 7-Steps Decision Cycle 349

The Principles 349

Who Can Benefit from PopcornFlow 350

Resources 351

Web-based resources: 351

Books: 351

Chapter 23: EventStorming by Alberto Brandolini 353

Silos and Value Streams 354

The Importance of Learning 355

The EventStorming Approach 356

The Workshop: A Quick Overview 356

Different Flavors of EventStorming 359

Complex Systems and Proven Solutions 360

Resources 360

Web 360

Books 360

License: CyberDojo 363

About CyberDojo Foundation Exercises 363

Web Resources 364

Sample Solutions 367

Sample Solutions: FizzBuzz in Clojure 367

Sample Solutions: Fibonacci Sequence in C++ 368

Sample Solutions: Roman Numerals in C# 369

Sample Solutions: Tic-Tac-Toe in Swift (Partial Solution) 385

Sample Solutions: Connecting Code Smells with Cohesion/Coupling 388

Sample Solutions: Connecting Object Calisthenics with Code Smells and Cohesion/Coupling 389

Sample Solutions: Connecting Cohesion/Coupling and SOLID Principles 389

Feedback 391

Personalized Coaching 391

Individuals 391

Organizations 392

Feedback Please 392

Preface

About

About the Book

About the Authors

Learning Objectives

Approach

Audience

Acknowledgements

Pedro

Marco

Alessandro

Conventions

Agile Technical Practices

Is This Book for Me?

Why We Wrote This Book?

Why Distilled?

Caution

What are Agile Technical Practices?

Pair Programming

Test-Driven Development TDD

Design Improvements/Refactoring

Simple Design

Beyond Design

Rules, Principles, and Values

How Rules Can Lead to Intellectual Laziness

Use Rules as a Shortcut to Internalize Principles

How This Book Is Organized

How to Get the Most out of This Book

Caution

Asking for Help or Feedback

Helping Others

Feedback about This Book

Resources

Section 1

First Steps

Chapter 1

Pair Programming

What is Pair Programming?

Caution

Important

Roles

Caution

Driver/Navigator Switch Techniques

Chess Clock

Ping Pong/Popcorn

Caution

Strong-Style Pairing

Breaks

Important

Pomodoro

Figure 1.1: Pomodoro clock

Caution

Katas

When Should I Move to the Next Lesson?

Resources

Web

Chapter 2

Classic TDD I – Test-Driven Development

Classic TDD

The Three Laws of TDD

1. You Are Not Allowed to Write Any More of a Unit Test That Is Sufficient to Fail, and Compilation Failures Are Failures

2. You Are Not Allowed to Write Any Production Code Unless It Is to Make a Failing Unit Test Pass

3. You Are Not Allowed to Write Any More Production Code That Is Sufficient to Pass the One Failing Unit Test

Figure 2.1: The red-green-refactor cycle of TDD

Refactoring and the Rule of Three – Baby Steps

Important

Important

Three Methods of Moving Forward in TDD

From Red to Green

Degrees of Freedom

Figure 2.2: Six degrees of freedom

Source: Wikimedia Commons (https://commons.wikimedia.org/wiki/File:6DOF_en.jpg)

Naming Tests

A Test Name Pattern

Katas

Fizz Buzz by cyber-dojo

Tip

Fizz Buzz Kata Summary

Figure 2.3: Table showing fizz buzz kata summary

Note

More Katas

Leap Year by cyber-dojo

Nth Fibonacci by cyber-dojo

Note

Great Habits

Considerations when Writing a New Test

Considerations When Making a Failing Test Pass

Considerations After the Test Passes

Classic TDD Flow

Figure 2.4: Test-driven programming workflow

Where are We in the Big Picture of Object-Oriented (OO) Software Design?

Figure 2.5: OO Design

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 3

Classic TDD II

Writing the Assertion First and Working Backward

Organizing Your Test in Arrange, Act, and Assert Blocks

Benefits of Organizing Tests in Arrange, Act, and Assert Blocks

Unit Test Principles

Katas

Stats Calculator by cyber-dojo

Anagrams by cyber-dojo

Great Habits

Considerations when Writing a New Test

Considerations when Making a Failing Test Pass

Considerations after the Test Passes

Classic TDD Flow

Figure 3.1: Classic TDD flow

Where are we in the Big Picture of Object-Oriented (OO) Software Design?

Figure 3.2: OO Design

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 4

Classic TDD III – Transformation Priority Premise

Kata

Roman Numerals by cyber-dojo

Figure 4.1: Roman numbers by cyber-dojo (1-1000)

Figure 4.2: Roman numbers by cyber-dojo (846, 1999, and 2008)

Important

TPP – Defining Obvious Implementation

TPP Table

Figure 4.3: TPP table

The Transformations

Transformation 1 – {} -> Nil

Transformation 2 – Nil -> Constant

Transformation 3 – Constant -> Constant+

Transformation 4 – Constant -> Scalar

Transformation 5 – Statement -> Statements

Transformation 6 – Unconditional -> Conditional

Transformation 7 – Scalar -> Array

Transformation 8 – Array -> Container

Transformation 9 – Statement -> Tail Recursion

Transformation 10 – If -> Loop

Transformation 11 – Statement -> Recursion

Transformation 12 – Expression -> Function

Transformation 13 – Variable -> Mutation

Important

Example Using the TPP on the Fibonacci Sequence

Figure 4.4: The TPP on the Fibonacci sequence

Katas

Roman Numerals by cyber-dojo

Note

Prime Factors by cyber-dojo

Figure 4.5: Prime factors by cyber-dojo

Boolean Calculator by Alessandro Di Gioia

Great Habits

Considerations when Writing a New Test

Considerations when Making a Failing Test Pass

Considerations after the Test Passes

Classic TDD flow

Figure 4.6: Classic TDD flow

Where are We in the Big Picture of Object-Oriented (OO) Software Design?

Figure 4.7: OO Design

When Should I Move to the Next Lesson?

Resources

Web

Chapter 5

Design 1 – Object Calisthenics

It's the Design...

Kata

Tic-Tac-Toe

Important

Object Calisthenics – 10 Steps to Better Software Design

Important

Only One Level of Indentation per Method

Don't Use the ELSE Keyword

Wrap All Primitives and Strings

First-Class Collections

No Getters/Setters/Properties

Wrap All Primitives and Strings

One Dot per Line

Don't Abbreviate

Keep All Entities Small

No Classes with More Than Two Instance Variables

All Classes Must Have State

Heuristics

Katas

Tic-Tac-Toe

Tip

Game of Life

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations after the Test Passes

Classic TDD flow

Figure 5.1: Classic TDD flow

Where Are We in the Big Picture of OO Software Design?

Figure 5.2: OO Design

When Should I Move on to the Next Lesson?

Resources

Web

Section 2

Walking

Chapter 6

Design 2 – Refactoring

Note

Note

When to Refactor (For Now)

Main Refactors

IDE Agility (Know Your Shortcuts)

Kata

Refactoring Golf

Hints

Refactor 80-20 Rule

Refactoring Guidelines

Stay in the Green While Refactoring

Commit as Often as Possible

Figure 6.1: Extended TDD cycle: the refactor cycle

Refactor Readability before Design

Change Design (Simple Changes)

Kata

Tennis Refactoring by Emily Bache

Parallel Change (Or Expand, Migrate, and Contract)

Expand

Migrate

Contract

Kata

Parallel Change Kata by Pawel Duda and Carlos Blé

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations after the Test Passes

When Should I Move on to the Next Lesson?

Resources

Web

Books

Chapter 7

Design 3 – Code Smells

Design Smells

Code Smells

Bloaters

Couplers

Object-Orientation Abusers

Change Preventers

Dispensables

Highlighted Code Smells

Code Smells Hierarchy

Primitive Obsession

Feature Envy

Message Chains

Object Calisthenics Preventing Code Smells

Figure 7.1: Object calisthenics violation and code smells consequence

When to Refactor (Extended for Code Smells)

Refactor Code Smells

Figure 7.2: Refactor code smells

Kata

Smelly Tic-Tac-Toe

Note

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations After the Test Passes

Classic TDD Flow

Figure 7.3: Classic TDD flow

The Big Picture

Figure 7.4: OO design—Has fewer elements

When Should I Move on to the Next Lesson?

Resources

Web

Books

Chapter 8

Test Doubles

Principles

Command-Query Separation

Note

Queries

Information

Figure 8.1: Use stubs for queries

Commands

Information

Figure 8.2: Use mocks for commands

Different Types of Test Doubles

Dummy Objects

Stubs

Fake Objects

Mocks

Spies

Figure 8.3: Venn diagram of Test Doubles

Test Doubles Guidelines

Only Use Test Doubles for Classes That You Own

Figure 8.4: Only use Test Doubles for classes that you own

Verify as Little as Possible in a Test

Don't Use Test Doubles for Isolated Objects

Figure 8.5: Don't use Test Doubles for isolated objects

Don't Add Behavior in Test Doubles

Only Use Test Doubles for Your Immediate Neighbors

Figure 8.6: Only use Test Doubles for your immediate neighbors

Too Many Test Doubles

CQS Principle Trade-OffS

Katas

Character Copier by Urs Enzler

Figure 8.7: Character copier

Instrument Processor by Urs Enzler

Figure 8.8: Instrument processor

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations after the Test Passes

When Should I Move on to the Next Lesson?

Resources

Web

Books

Chapter 9

Testing Legacy Code

Breaking Dependencies Using a Seam

Using Inheritance to Decouple Production Code

Characterization Tests

Kata

Characterization Tests on Gilded Rose Kata by Emily Bache

Golden Master

Feasibility

Generate Input/Output (Golden Master)

Assert

Kata

Golden Master on Gilded Rose Kata by Emily Bache

Hints:

Approval Tests by Llewellyn Falco

Combination Tests

Revisiting the Refactoring Guidelines

Stay in the Green while Refactoring

Kata

Gilded Rose Refactoring Kata by Emily Bache

Conclusions

Guideline Questions

Great Habits

Considerations when Writing a New Test

Considerations when Making a Failing Test Pass

Considerations after the Test Passes

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 10

Design IV –Design Patterns

Note

Design Pattern Advantages

Design Pattern Pitfalls

Caution

A Quick Reference Catalogue

Creational Design Patterns

Figure 10.1: The creational design patterns

Behavioral Design Patterns

Figure 10.2: The behavioral design patterns (part 1)

Figure 10.3: The behavioral design patterns (part 2)

Figure 10.4: The behavioral design patterns (part 2)

Structural Design Patterns

Figure 10.5: Structural design patterns

Revisiting the Refactoring Guidelines

Refactoring Design

Kata

Refactoring Game of Life Kata to Patterns

Caution

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations After the Test Passes

When Should I Move to the Next Lesson?

Resources

Web

Books

Section 3

Running

Chapter 11

Design V – Cohesion and Coupling

Coupling

Types of Coupling

Interaction Coupling

Figure 11.1: Relative ranking of interaction coupling types

Law of Demeter

Method Coupling Premises

Figure 11.2: Method coupling premises with relative impact

Inheritance Coupling

Cohesion

Note

Other Indicators of Possible Low Cohesion in Design

Types of Cohesion

Class Cohesion

Figure 11.3: Relative ranking of class cohesion types

Method Cohesion

Figure 11.4: Method cohesion relative ranking

Katas

Connecting Code Smells with Cohesion/Coupling

Figure 11.5: Connecting code smells with cohesion/coupling

Note

Connecting Object Calisthenics with Code Smells and Cohesion/Coupling

Figure 11.6: Connecting object calisthenics with code smells and cohesion/coupling

Note

When to Refactor (Extended for Cohesion/Coupling)

Classic TDD Flow

Figure 11.7: Classic TDD flow

The Big Picture

Figure 11.8: Object-oriented design

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 12

Design VI – Solid Principles ++

Single Responsibility Principle

Note

Open/Closed Principle

Note

Liskov Substitution Principle

Note

Interface Segregation Principle

Note

Dependency Inversion Principle

Figure 12.1: Depending on interfaces inverts the direction of dependencies

Balanced Abstraction Principle

Principle of Least Astonishment

Note

Kata

Connecting Cohesion/Coupling and SOLID principles

Figure 12.2: Connecting cohesion/coupling and SOLID principles

Note

When to Refactor (Extended for SOLID Principles)

Classic TDD Flow

Figure 12.3: Classic TDD flow

The Big Picture

Figure 12.4: The big picture

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 13

Design VII – Connascence

Definition

Note

Note

Figure 13.1: The three dimensions of connascence

Dimensions

Degree

Locality

Strength

Figure 13.2: Direction of connascence refactoring

Connascence of Name and Type (CoN and CoT)

Figure 13.3: Types of connascence

Connascence of Position

Connascence of Value (CoV)

Figure 13.4: Sides relation for being a triangle

Figure 13.5: Triangle defined by a, b, and x

Connascence of Meaning

Connascence of Algorithm

Connascence of Execution Order

Connascence of Timing

Connascence of Identity

Connascence of Manual Task

Classic TDD Flow

Figure 13.6: Classic TDD flow

The Big Picture

Figure 13.7: The big picture

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 14

Design VIII –The Four Elements of Simple Design

What Are the Four Elements of Simple Design?

Note

What Does Each Element Mean?

Passes Its Tests

Minimizes Duplication

Maximizes Clarity

Note

Has Fewer Elements

Alternative Definitions of Simple Design

Definition #1

Definition #2

Definition #3

Definition #4

Definition #5

Definition #6

Note

Our Personal Definitions of Simple Design

Pedro

Marco

Alessandro

Kata

Elevator Kata by Marco Consolaro

Classic TDD Flow

Figure 14.1: Classic TDD flow

The Big Picture

Figure 14.2: The big picture

When Should I Move to the Next Lesson?

Resources

Web

Books

Chapter 15

Conclusion

Figure 15.1: Good design and bad design, refactoring impact over time

Cohesion and Coupling as Forces

Figure 15.2: Newton's law of universal gravitation

The 3 Cs of Design: From Cohesion and Coupling to Connascence

Figure 15.3: Left: metrics and analytics for feedback; right: rules and principles for guidance

Note

Figure 15.4: Coupling, cohesion, and connascence as gauges for entropy

Systems Entropy

The Relevance of Systems Entropy

Note

Note

Note

Software Development as System Building

Note

Good Design as a Low-Entropy System

The Big Picture

Figure 15.5: Object-oriented design

Resources

Web-based resources:

Books:

Section 4

Flying

Chapter 16

Outside-In Development

The Classic TDD Approach

Figure 16.1: Classic TDD flow

Acceptance Tests

Note

Note

Acceptance Test Styles

Note

Test Boundaries

Figure 16.2: Test boundaries

Double Loop TDD

Figure 16.3: Double loop TDD

The Outside-In Approach

An Outside-In Mindset

Outside-In TDD: The London School

Figure 16.4: Outside-In TDD flow

Example

The Direction of Dependencies

Figure 16.5: The direction of dependencies

Should I Use Classic TDD or Outside-In TDD?

Kata

Stock Portfolio

Katacombs of Shoreditch by Marco Consolaro

Note

Part I

PART II

The Big Picture

Figure 16.6: Object-oriented design

Great Habits

Considerations When Writing a New Test

Considerations When Making a Failing Test Pass

Considerations After the Test Has Passed

Resources

Web-based resources:

Books:

Chapter 17

Behavior-Driven Development

Poka-Yoke

Mistakes versus Defects: Feedback Is the Cure (Again)

Figure 17.1: Agile feedback loops

Bugs and Communication

Note

Note

Figure 17.2: The bugs' impact

User Stories

Note

Note

Behavior-Driven Development

The Structure of a Story

Note

Figure 17.3: The structure of a sample story

Acceptance Criteria: It's All about the Examples

Note

From Criteria to Acceptance Tests

Acceptance Tests Done Right

Readable by Business Folks

Note

Feature Complete

Fast

Boundaries

The Walking Skeleton

Kata

The Messy Delivery Office Requirements

Resources

Web-based resources

Books

Chapter 18

Understand the Business

Note

Knowledge versus Understanding

Note

Note

Note

Theory of Constraints

Note

Figure 18.1: The five focusing steps of the TOC

Note

Domain-Driven Design: What Domain?

Note

Note

Beyond Requirements: Knowledge Crunching

Note

5 Whys

Note

Figure 18.2: 5 Whys

Note

Note

Impact Mapping

Figure 18.3: Impact mapping

Note

Note

PopcornFlow

Note

Note

User Story Mapping

Note

Figure 18.4: Example of a user story map

EventStorming

Business Model Canvas

Note

Note

Figure 18.5: Business Model Canvas with questions, flow of money, and flow of value

Value Streams and Domain Events

Figure 18.6: A high-level representation of a value stream as a sequence of activities

Figure 18.7: Activities of the value stream mapped into bounded contexts

Figure 18.8: Activities of the value stream raising domain events

Bounded Contexts and Communication

Note

Note

Note

Note

Synchronous versus Asynchronous

Figure 18.9: Bounded context communication

Command-Query Separation

Note

Business and DevOps

The First Way

Note

Figure 18.10: DevOps, the First Way

The Second Way

Note

Figure 18.11: DevOps, the Second Way

The Third Way

Note

Figure 18.12: DevOps, the Third Way

Systems Thinking and Sociotechnical Organizations

Note

Note

Resources

Web-based resources

Books

Chapter 19

Story of Team C

Note

Terraforming

Team Building

Note

The Backlog: Crunching Knowledge for Breakfast

Cracking On

From Forming to Performing

Outside-In ATDD with Optional Unit Tests

Note

The Green Flag

The Moral of the Story

Note

Chapter 20

Conclusion

Note

The Human Factor

Note

Team Play

Figure 20.1: The three essential virtues of the "ideal team player" by Patrick Lencioni

Bounded Rationality and Knowledge Sharing

Resources

Web

Books

Chapter 21

The 12 Agile Principles

Chapter 22

PopcornFlow by Claudio Perrone

Figure 22.1: Popcorn flow

The 7-Steps Decision Cycle

The Principles

Note

Who Can Benefit from PopcornFlow

Resources

Web-based resources:

Books:

Chapter 23

EventStorming by Alberto Brandolini

Silos and Value Streams

Note

Figure 23.1: EventStorming by Alberto Brandolini

Note

The Importance of Learning

The EventStorming Approach

The Workshop: A Quick Overview

Figure 23.2: The room setup before the workshop

Figure 23.3: Building the narrative of the business

Figure 23.4: The result of enabling shared understanding

Different Flavors of EventStorming

Complex Systems and Proven Solutions

Resources

Web

Books

License: CyberDojo

About CyberDojo Foundation Exercises

Web Resources

Sample Solutions

Sample Solutions: FizzBuzz in Clojure

Sample Solutions: Fibonacci Sequence in C++

Sample Solutions: Roman Numerals in C#

Note

Sample Solutions: Tic-Tac-Toe in Swift (Partial Solution)

Sample Solutions: Connecting Code Smells with Cohesion/Coupling

Figure 25.1: Connecting code smells with cohesion/coupling

Sample Solutions: Connecting Object Calisthenics with Code Smells and Cohesion/Coupling

Figure 25.2 : Connecting object calisthenics with code smells and cohesion/coupling

Sample Solutions: Connecting Cohesion/Coupling and SOLID Principles

Figure 25.3: Connecting cohesion/coupling and SOLID principles

Feedback

Personalized Coaching

Individuals

Organizations

Feedback Please

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部