Book Image

Mastering PHP Design Patterns

By : Junade Ali
Book Image

Mastering PHP Design Patterns

By: Junade Ali

Overview of this book

Design patterns are a clever way to solve common architectural issues that arise during software development. With an increase in demand for enhanced programming techniques and the versatile nature of PHP, a deep understanding of PHP design patterns is critical to achieve efficiency while coding. This comprehensive guide will show you how to achieve better organization structure over your code through learning common methodologies to solve architectural problems. You’ll also learn about the new functionalities that PHP 7 has to offer. Starting with a brief introduction to design patterns, you quickly dive deep into the three main architectural patterns: Creational, Behavioral, and Structural popularly known as the Gang of Four patterns. Over the course of the book, you will get a deep understanding of object creation mechanisms, advanced techniques that address issues concerned with linking objects together, and improved methods to access your code. You will also learn about Anti-Patterns and the best methodologies to adopt when building a PHP 7 application. With a concluding chapter on best practices, this book is a complete guide that will equip you to utilize design patterns in PHP 7 to achieve maximum productivity, ensuring an enhanced software development experience.
Table of Contents (14 chapters)
Mastering PHP Design Patterns
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Code smells


Code smells are essentially bits of bad practice that make your code needlessly harder to understand, bad code may be refactored away using the techniques expressed in this chapter. Code smells can usually violate somewhat fundamental software design principles and accordingly, can negatively impact design quality of the overall code.

Martin Fowler defined code smell by stating the following:

"a code smell is a surface indication that usually corresponds to a deeper problem in the system".

At the start of this book we discussed the term technical debt, in this sense, code smells can contribute to technical debt as a whole.

Code smell may not necessarily constitute a bug, it won't stop the execution of a program, but it can aid the process of introducing bugs later on and make it harder to refactor code to an appropriate design.

Let's cover some fundamental code smells that you may encounter when dealing with legacy PHP projects.

We will address some code smells and how to address...