Table of Contents
Foreword xv
Acknowledgments xvii
Introduction xix
Who Is This Book For? xxi
What Will You Learn? xxi
1 How Complexity Harms Your Productivity 1
What Is Complexity? 4
Complexity in a Project Life Cycle 4
Planning 5
Defining 5
Designing 6
Building 6
Testing 6
Deployment 8
Complexity in Software and Algorithmic Theory 8
Complexity in Learning 13
Complexity in Processes 15
Complexity in Your Daily Life, or Death by a Thousand Cuts 16
Conclusion 17
2 The 80/20 Principle 19
80/20 Principle Basics 19
Application Software Optimization 21
Productivity 22
Success Metrics 24
Focus and the Pareto Distribution 25
Implications for Coders 27
A Success Metric for Programmers 27
Pareto Distributions in the Real World 28
Pareto Is Fractal 32
80/20 Practice Tips 34
Resources 35
3 Build a Minimum Viable Product 39
A Problem Scenario 40
Loss of Motivation 41
Distraction 41
Running Over Time 41
Lack of Response 42
Wrong Assumptions 42
Unnecessary Complexity 43
Building a Minimum Viable Product 44
Four Pillars of Building a Minimum Viable Product 47
Advantages of the Minimum Viable Product 48
Stealth vs. Minimum Viable Product Approach 48
Conclusion 49
4 Write Clean and Simple Code 51
Why Write Clean Code? 52
Writing Clean Code: The Principles 53
Principle 1 Think About the Big Picture 54
Principle 2 Stand on the Shoulders of Giants 55
Principle 3 Code for People, Not Machines 56
Principle 4 Use the Right Names 57
Principle 5 Adhere to Standards and Be Consistent 58
Principle 6 Use Comments 59
Principle 7 Avoid Unnecessary Comments 61
Principle 8 The Principle of Least Surprise 63
Principle 9 Don't Repeat Yourself 63
Principle 10 Single Responsibility Principle 65
Principle 11 Test 68
Principle 12 Small Is Beautiful 69
Principle 13 The Law of Demeter 70
Principle 14 You Ain't Gonna Need It 74
Principle 15 Don't Use Too Many Levels of Indentation 75
Principle 16 Use Metrics 76
Principle 17 Boy Scout Rule and Refactoring 76
Conclusion 77
5 Premature Optimization is the Root of All Evil 79
Six Types of Premature Optimization 79
Optimizing Code Functions 80
Optimizing Features 80
Optimizing Planning 81
Optimizing Scalability 81
Optimizing Test Design 81
Optimizing Object-Oriented World Building 82
Premature Optimization: A Story 82
Six Tips for Performance Tuning 85
Measure First, Improve Second 86
Pareto Is King 86
Algorithmic Optimization Wins 88
All Hail the Cache 89
Less Is More 91
Know When to Stop 92
Conclusion 92
6 Flow 93
What Is Flow? 94
How to Achieve Flow 95
Clear Goals 95
Feedback Mechanism 95
Balance Opportunity and Capacity 96
Flow Tips for Coders 97
Conclusion 98
Resources 99
7 Do One Thing Well and Other Unix Principles 101
The Rise of Unix 102
Philosophy Overview 102
15 Useful Unix Principles 103
1 Make Each Function Do One Thing Well 103
2 Simple Is Better Than Complex 106
3 Small Is Beautiful 107
4 Build a Prototype as Soon as Possible 108
5 Choose Portability Over Efficiency 109
6 Store Data in Flat Text Files 110
7 Use Software Leverage to Your Advantage 111
8 Avoid Captive User Interfaces 113
9 Make Every Program a Filter 116
10 Worse Is Better 117
11 Clean Code Is Better Than Clever Code 118
12 Design Programs to Connect With Other Programs 119
13 Make Your Code Robust 119
14 Repair What You Can-But Fail Early and Noisily 120
15 Avoid Hand-Hacking: Write Programs to Write Programs If You Can 122
Conclusion 122
Resources 123
8 Less Is More in Design 125
Minimalism in the Evolution of Mobile Phones 126
Minimalism in Search 127
Material Design 128
How to Achieve Minimalistic Design 129
Use Whitespace 129
Remove Design Elements 131
Remove Features 132
Reduce Variations of Fonts and Colors 133
Be Consistent 134
Conclusion 134
Resources 134
9 Focus 135
The Weapon Against Complexity 135
Unifying the Principles 138
Conclusion 140
Letter from the Author 141
Index 143