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 ...

Get Mastering PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.