Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Clean Code in PHP

You're reading from  Clean Code in PHP

Product type Book
Published in Oct 2022
Publisher Packt
ISBN-13 9781804613870
Pages 264 pages
Edition 1st Edition
Languages
Authors (2):
Carsten Windler Carsten Windler
Profile icon Carsten Windler
Alexandre Daubois Alexandre Daubois
Profile icon Alexandre Daubois
View More author details
Toc

Table of Contents (18) Chapters close

Preface 1. Part 1 – Introducing Clean Code
2. Chapter 1: What Is Clean Code and Why Should You Care? 3. Chapter 2: Who Gets to Decide What “Good Practices” Are? 4. Chapter 3: Code, Don’t Do Stunts 5. Chapter 4: It is about More Than Just Code 6. Chapter 5: Optimizing Your Time and Separating Responsibilities 7. Chapter 6: PHP is Evolving – Deprecations and Revolutions 8. Part 2 – Maintaining Code Quality
9. Chapter 7: Code Quality Tools 10. Chapter 8: Code Quality Metrics 11. Chapter 9: Organizing PHP Quality Tools 12. Chapter 10: Automated Testing 13. Chapter 11: Continuous Integration 14. Chapter 12: Working in a Team 15. Chapter 13: Creating Effective Documentation 16. Index 17. Other Books You May Enjoy

Separating responsibilities

Let’s see what the separation of responsibilities in the code consists of, to make it cleaner, understandable, maintainable, and extensible. This is the first point of the SOLID principles. In the second chapter, this is how we defined the principle of single responsibility: “It means that a class in your code must respond to only one task.

As a reminder, SOLID is a set of known clean-code rules that, when applied together, will make your code much clearer and more accurate. Rather than trying to follow the five principles described by each of the SOLID caps to the letter, it is more important to have a global idea of all this in mind when you code.

The first step to respect this is, in fact... naming, as we just saw! Indeed, by naming a class properly, clearly, and, above all, precisely, you are already making sure that it doesn’t become a mess where you put a little bit of everything that you can think of. And it is for...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}