Recipes to Improve the Design and Quality of Your Code
Maximiliano Contieri

#Clean_Code
#Cookbook
Often, software engineers and architects work with large, complex code bases that they need to scale and maintain. With this cookbook, author Maximiliano Contieri takes you beyond the concept of clean code by showing you how to identify improvement opportunities and their impact on production code. When it comes to reliability and system evolution, these techniques provide benefits that pay off over time.
Using real life examples in JavaScript, PHP, Java, Python, and many other programming languages, this cookbook provides proven recipes to help you scale and maintain large systems. Every section covers fundamental concepts including readability, coupling, testability, and extensibility, as well as code smells—symptoms of a problem that requires special attention—and the recipes to address them.
As you proceed through this book, refactoring recipes and the variety of code smells increase in complexity. You will:
Table of Contents
Chapter 1. Clean Code
Chapter 2. Setting Up the Axioms
Chapter 3. Anemic Models
Chapter 4. Primitive Obsession
Chapter 5. Mutability
Chapter 6. Declarative Code
Chapter 7. Naming
Chapter 8. Comments
Chapter 9. Standards
Chapter 10. Complexity
Chapter 11. Bloaters
Chapter 12. YAGNI
Chapter 13. Fail Fast
Chapter 14. Ifs
Chapter 15. Null
Chapter 16. Premature Optimization
Chapter 17. Coupling
Chapter 18. Globals
Chapter 19. Hierarchies
Chapter 20. Testing
Chapter 21. Technical Debt
Chapter 22. Exceptions
Chapter 23. Metaprogramming
Chapter 24. Types
Chapter 25. Security
From the Preface
Code is everywhere, from web development to smart contracts, embedded systems, blockchains, James Webb’s onboard software system, surgical robots, and many other domains. Software is effectively taking over the world, and we are currently witnessing the rise of professional artificial intelligence code-generation tools. That means clean code is more important than ever. As you continue to work in increasingly large proprietary or open source codebases, clean code is the way of keeping it fresh and ready to evolve.
Who This Book Is For
This book helps you identify common problems in a codebase and highlights the consequences of these problems, and ultimately helps you avoid them with easy-to-follow recipes. It is a valuable resource that can greatly aid programmers, code reviewers, architects, and students in improving their code skills and existing systems.
What You Need to Use This Book
In order to run the code samples, you will need a working environment like O’Reilly sandboxes or Replit. I encourage you to translate the code samples into your favorite programming language. Nowadays you can do it for free with artificial intelligence code generators. I’ve used tools such as GitHub Copilot, OpenAI Codex, Bard, ChatGPT, and many more to help me write this book’s code samples. Utilizing these tools has allowed me to use more than 25 different languages in this book even though I am not an expert in many of them.
Maximiliano Contieri has been working in the software industry for 25 years and also teaching at the university at the same time. He's been writing about clean code, refactoring and code smells for three years, writing a couple of articles per week on many popular blogging platforms. He is a declarative and behavioral code fan and relies on software fundamentals to build elegant and robust solutions.









