How to Reduce Code Complexity and Develop Software More Sustainably
"Mark Seemann is well known for explaining complex concepts clearly and thoroughly. In this book he condenses his wide-ranging software development experience into a set of practical, pragmatic techniques for writing sustainable and human-friendly code. This book will be a must-read for every programmer."
-- Scott Wlaschin, author of Domain Modeling Made Functional Code That Fits in Your Head offers indispensable, practical advice for writing code at a sustainable pace and controlling the complexity that causes projects to spin out of control.
Reflecting decades of experience helping software teams succeed, Mark Seemann guides you from zero (no code) to deployed features and shows how to maintain a good cruising speed as you add functionality, address cross-cutting concerns, troubleshoot, and optimize. You'll find valuable ideas, practices, and processes for key issues ranging from checklists to teamwork, encapsulation to decomposition, API design to unit testing.
Seemann illuminates his insights with code examples drawn from a complete sample project. Written in C#, they're designed to be clear and useful to anyone who uses any object-oriented language including Java , C++, and Python. To facilitate deeper exploration, all code and extensive commit messages are available for download.
- Choose mindsets and processes that work, and escape bad metaphors that don't
- Use checklists to liberate yourself, improving outcomes with the skills you already have
- Get past “analysis paralysis” by creating and deploying a vertical slice of your application
- Counteract forces that lead to code rot and unnecessary complexity
- Master better techniques for changing code behavior
- Discover ways to solve code problems more quickly and effectively
- Think more productively about performance and security
If you've ever suffered through bad projects or had to cope with unmaintainable legacy code, this guide will help you make things better next time and every time.
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Author(s): Mark Seemann
Series: Robert C. Martin Series
Edition: 1
Publisher: Addison-Wesley Professional
Year: 2021
Language: English
Pages: 406
Tags: Software Engineering; Software Development; Best Practices; 50/72 Rule; 80/24 Rule; Arrange Act Assert
Cover Page
About This eBook
Half Title
Title Page
Copyright Page
Dedication Page
Contents
Series Editor Foreword
Preface
About the Author
I: Acceleration
1. Art or Science?
1.1 Building a House
1.2 Growing a Garden
1.3 Towards Engineering
1.4 Conclusion
2. Checklists
2.1 An Aid to Memory
2.2 Checklist for a New Code Base
2.3 Adding Checks to Existing Code Bases
2.4 Conclusion
3. Tackling Complexity
3.1 Purpose
3.2 Why Programming Is Difficult
3.3 Towards Software Engineering
3.4 Conclusion
4. Vertical Slice
4.1 Start with Working Software
4.2 Walking Skeleton
4.3 Outside-in
4.4 Complete the Slice
4.5 Conclusion
5. Encapsulation
5.1 Save the Data
5.2 Validation
5.3 Protection of Invariants
5.4 Conclusion
6. Triangulation
6.1 Short-Term versus Long-Term Memory
6.2 Capacity
6.3 Conclusion
7. Decomposition
7.1 Code Rot
7.2 Code That Fits in Your Brain
7.3 Conclusion
8. API Design
8.1 Principles of API Design
8.2 API Design Example
8.3 Conclusion
9. Teamwork
9.1 Git
9.2 Collective Code Ownership
9.3 Conclusion
II: Sustainability 201
10. Augmenting Code
10.1 Feature Flags
10.2 The Strangler Pattern
10.3 Versioning
10.4 Conclusion
11. Editing Unit Tests
11.1 Refactoring Unit Tests
11.2 See Tests Fail
11.3 Conclusion
12. Troubleshooting
12.1 Understanding
12.2 Defects
12.3 Bisection
12.4 Conclusion
13. Separation of Concerns
13.1 Composition
13.2 Cross-Cutting Concerns
13.3 Conclusion
14. Rhythm
14.1 Personal Rhythm
14.2 Team Rhythm
14.3 Conclusion
15. The Usual Suspects
15.1 Performance
15.2 Security
15.3 Other Techniques
15.4 Conclusion
16. Tour
16.1 Navigation
16.2 Architecture
16.3 Usage
16.4 Conclusion
A. List of Practices
A.1 The 50/72 Rule
A.2 The 80/24 Rule
A.3 Arrange Act Assert
A.4 Bisection
A.5 Checklist for A New Code Base
A.6 Command Query Separation331
A.7 Count the Variables
A.8 Cyclomatic Complexity
A.9 Decorators for Cross-Cutting Concerns
A.10 Devil’s Advocate
A.11 Feature Flag
A.12 Functional Core, Imperative Shell
A.13 Hierarchy of Communication
A.14 Justify Exceptions from the Rule
A.15 Parse, Don’t Validate
A.16 Postel’s Law
A.17 Red Green Refactor
A.18 Regularly Update Dependencies
A.19 Reproduce Defects as Tests
A.20 Review Code
A.21 Semantic Versioning
A.22 Separate Refactoring of Test and Production Code
A.23 Slice
A.24 Strangler
A.25 Threat-Model
A.26 Transformation Priority Premise
A.27 X-driven Development
A.28 X Out Names
Bibliography
Index
Code Snippets