"Computer science is no more about computers than astronomy is about telescopes" Edsger W. Dijkstra

Pro PHP Refactoring

Posted: December 11th, 2010 | Author: | Filed under: Books | Tags: , , | No Comments »

Like PHP consultant I meet every day companies that have to fight with legacy code. Often the developers that built the software have left the company and the new programmers prefer rewrite the software from scratch instead of mantain the old one. The business decision to rewrite a software from scratch is always a difficult task because rewriting software means spend time and money. This is an old story and I’m sure you have already seen it.

If you want to know when and how to refactor a PHP application I suggest to have a look at this new book Pro PHP Refactoring by Francesco Trucchia and Jacopo Romei (Apress publisher, 2010). In this book the authors describe what is the software refactoring, when you should refactor a PHP code and how to do that. This book is the summary of all the principles, best practices and suggestions collected by the authors in the last years. It represents a bridge between the PHP language and the refactoring techniques developed by Martin Flower and the agile community.

Most of the chapters show how to refactor your code using different techniques to change the structuring behavior, the class responsibilities, dealing with data rationalization, simplifying method calls, etc.

I found very interesting the second chapter Finding “bas smells” in code, where you can understand when is the time to think about refactoring and the Refactoring tools chapter where the authors show how to choose the right PHP tools to help the refactoring job.

In conclusion, I definitely suggest to have this book in your PHP toolbox, you will find it useful in the right moment.