PHP Classes

Title: Modernizing Legacy Applications In PHP

Recommend this page to a friend!

  Latest classes All reviews   Modernizing Legacy Applications In PHP   Latest classes Latest reviews   Best sellers ranking Best sellers ranking  

Title

Modernizing Legacy Applications In PHP

Category

PHP books

Author

Paul M. Jones

Publisher

Leanpub

Release date

April 21, 2014

Sales ranking

Week: Not ranked All time: 382

Reviews

June 29, 2015
  Post a comment Post a comment   See comments See comments   Find where to Buy Now Find where to Buy Now  
Modernizing Legacy Applications In PHP reviewed by
Picture of Samuel Adeshina
Samuel Adeshina
samshal.github.io
Legacy applications are programs that have been inherited from or written with "outdated" technologies and techniques that are no longer being in use or maybe based on technologies no longer supported by the original vendors.

Many of us may have been developing PHP applications, libraries, frameworks, components for a very long time. The techniques used for writing PHP code ten years ago are completely different from what we have today. This makes applications that were written then and are still in use today "Legacy Applications".

The current technologies we have today and the numerous improvements to the PHP programming language, makes our legacy applications operate "below today’s standards". They need to be improved or rewritten, but who would want to rewrite an application of many thousands or millions of lines of code?

That’s why you should read this book, ‘Modernizing Legacy Applications in PHP’ by Paul M. Jones. It explains the nitty-gritty of how PHP applications were built over a decade ago and why they are now called legacy applications. He explains why your legacy applications are not meant to be rewritten, but optimized and improved to support today’s standards.

The author begins the book by telling us what legacy applications are and how to recognize one when you see it. He gave examples of features you might find in a PHP legacy application which are bad practices according to today’s standards.

In chapter one, he also explains that applications based on frameworks too could be termed as ‘legacy applications’. In fact, he calls them framework-based legacy applications.

In chapter two, he mentions some the prerequisites necessary to modernizing a legacy system. Some of this prerequisites are a version control system, a 5.0 or higher version of PHP, an editor or IDE appropriate for programming, and a test suite. He explains each of this ‘prerequisites’, telling us how to get, install and use them, providing links to external resources where appropriate.

Chapter three, which was one of my favorite and most interesting chapters ‘Implement An Autoloader’ explains how to develop an ‘include-less’ or a ‘require-less’ object oriented PHP application. Explaining the disadvantages of using include-heavy applications and provides a better alternative, using an autoloader. He concisely explained this concept and provided example scenarios of how they can be implemented.

In chapter four, the author talks about how to change the structure of Legacy applications and consolidate your classes and functions to support today’s standards, he continued this chapter by building upon the foundation laid out in chapter three, changing the locations of certain functions and classes depending on how they are referenced within the application.

He introduces the concept of Dependency Injection in chapters five and six, giving reasons why adding a dependency injection to a program is better than all other alternatives. He gives a very concise explanation of this concept and explains how to remove a global dependency.

In chapter seven, he talks about the most ignored part of software development among PHP developers, ‘Writing Tests and Testable programs’. He explains how to make a legacy application testable, and how to write good tests for them. He also includes tips and tricks for writing a test for PHP applications.

The author started talking about maintaining, and optimizing the databases of a legacy application by explaining the concept of Gateways in chapter eight and explained how to extract SQL statements into gateways, that is into a different class, thereby separating database logic from the main app logic.

Chapters nine, ten and eleven explained the popular MVC design pattern, which are common in today’s frameworks and PHP development architectures. He explains how to implement the model-view-controller pattern into a legacy application, separating the presentation logic from the back-end logic and the database queries.

Chapter twelve also continues to build on the foundation laid out in chapter three, explaining the reasons why using include, include_once, require or require_once keywords can be ineffective. He provides a very easy approach to changing or removing them in a PHP application.

Chapter thirteen introduces a very nice security concept, separating public resources from non-public resources. Legacy applications are best known for having the index files and main files of a whole application in a single directory or unsecured sub directories. The author really did a great job in this chapter in explaining how to differentiate resources available to different categories of users by storing them in different locations.

In chapter fourteen, the author introduces the concept of a front controller, and explained how to decouple URL paths from file paths, making URL paths independent of the file path of the scripts its calling, thereby preventing attacks that may arise through ‘manipulating file paths using URLs’.

Redundancy, which is also one of the greatest features of a procedural legacy application is treated in chapter fifteen. The author explains how to prevent them from occurring and how to remove them from a legacy applications using best practices available in today’s modern PHP.

This chapter is more of a "cleaning up" chapter. It doesn't remove previously existing redundancy in the application. Instead, after having extracted so much from the page scripts, the remaining pieces all look very similar and repetitive. This chapter removes the repeated setup work in the page scripts by moving the common logic up to the front controller.

The last chapter explains the last and one of the most important step in converting a legacy app into a modernized one. The author talks about dependency injection containers, why they are necessary and how they can be implemented.

{buttons}After going through this book, I discovered that it is not just apps that were built ‘over a decade ago’ that deserves to be called legacy applications.

Many of the apps we write today also have some of the bad features which makes them worthy to be termed a ‘legacy application’. I felt guilty, because I use a lot of these bad features in my day to day PHP development process, even when I claim I am developing object oriented applications and I believe I am not alone.

I strongly recommend this material to the PHP professionals out there, there are a lot of things we ‘claim’ and ‘think’ we are doing right, just read this book and see for yourself.

Code maintenance engineers from other spheres or areas of software development would also find this book very intrinsic, as it provides references and links to external materials that would help you learn and know more.

This book is a very bright light, that shows us a lot of places and instances where we get it all wrong when it comes to developing with PHP, and also provides how to make them right. Software Maintenance Engineers would find this book very useful, because it laid out a step by step, and chapter by chapter introduction into code maintenance and optimization.

After going through this book, I discovered that it is not just apps that were built ‘over a decade ago’ that deserves to be called legacy applications.

Many of the apps we write today also have some of the bad features which makes them worthy to be termed a ‘legacy application’. I felt guilty, because I use a lot of these bad features in my day to day PHP development process, even when I claim I am developing object oriented applications and I believe I am not alone.

I strongly recommend this material to the PHP professionals out there, there are a lot of things we ‘claim’ and ‘think’ we are doing right, just read this book and see for yourself.

Code maintenance engineers from other spheres or areas of software development would also find this book very intrinsic, as it provides references and links to external materials that would help you learn and know more.

This book is a very bright light, that shows us a lot of places and instances where we get it all wrong when it comes to developing with PHP, and also provides how to make them right. Software Maintenance Engineers would find this book very useful, because it laid out a step by step, and chapter by chapter introduction into code maintenance and optimization.
  Post a comment Post a comment   See comments See comments   Find where to Buy Now Find where to Buy Now  

Comments

No comments were submitted yet.

Post a comment