Clean Code in PHP Expert Tips and Best Practices to Write Beautiful, Human-Friendly, and Maintainable PHP /
Practical lessons, examples, and practices from PHP experts on how to take your PHP skills to a professional level Key Features Easily navigate to key clean code principles specific to PHP development with this hands-on guide Learn the how and why of writing clean code through practical examples Ski...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Otros Autores: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing, Limited,
2022.
|
Edición: | 1st edition. |
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright & Credits
- Contributors
- Table of Contents
- Preface
- Part 1
- Introducing Clean Code
- Chapter 1: What Is Clean Code and Why Should You Care?
- What this book will cover
- Understanding what clean code is
- The importance of clean code in teams
- The importance of clean code in personal projects
- Summary
- Chapter 2: Who Gets to Decide What "Good Practices" Are?
- Who decides these things anyway?
- Best practices
- where do they really come from?
- Design pattern principles
- Being context-aware
- Being consistent
- get results quicker
- About source code analysis tools
- About testing and its multiple forms
- Summary
- Chapter 3: Code, Don't Do Stunts
- Understanding code
- A bit of history
- The purpose of code
- Be understood, not clever
- A note on maintainability
- Using binary operators and octal, hexadecimal, and binary notations
- Assigning a variable and using gotos
- Excessively using comments
- Using ternary comparisons
- Using abbreviations
- Bringing micro-optimizations to your code
- Recoding the methods of the SPL
- Summary
- Chapter 4: It is about More Than Just Code
- PHP as an ecosystem
- Choosing the right libraries
- A word about semantic versioning
- What is semantic versioning?
- How to deal with semantic versioning
- Stability versus trends
- Summary
- Chapter 5: Optimizing Your Time and Separating Responsibilities
- Naming and organizational conventions
- Class files and interface files
- Executables
- Web assets and resources
- Naming classes, interfaces, and methods
- Naming folders
- Separating responsibilities
- Event dispatching
- Demystifying polymorphism
- interfaces and abstract classes
- Interfaces
- Abstract classes
- Summary
- Chapter 6: PHP is Evolving
- Deprecations and Revolutions
- Old versus new PHP
- Strict typing
- Error reporting
- Attributes
- The version 8 revolution
- Match syntax
- Named arguments
- Read-only classes and properties
- Migrating resources to proper classes
- Protecting your sensitive arguments from leaking
- Summary
- Part 2
- Maintaining Code Quality
- Chapter 7: Code Quality Tools
- Technical requirements
- Syntax checking and code styling
- The PHP built-in linter
- PHP CS Fixer: a code sniffer
- Static Code Analysis
- phpcpd
- the copy and paste detector
- PHPMD: the PHP mess detector
- PHPStan
- a static analyzer for PHP
- Psalm: A PHP static analysis linting machine
- IDE extensions
- PHP Inspections (EA Extended)
- Intelephense
- Summary
- Further reading
- Chapter 8: Code Quality Metrics
- Technical requirements
- Introducing code quality metrics
- Aspects of software quality
- Code quality metrics
- Gathering metrics in PHP
- phploc
- PHP Depend
- PhpMetrics
- The pros and cons of using metrics
- The pros
- The cons
- Summary
- Further reading
- Chapter 9: Organizing PHP Quality Tools
- Technical requirements