Refactoring Legacy Applications Using CakePHP
Have you ever wanted to start using the CakePHP web application framework, but were wondering about it's use in the real world? As an experienced developer who is familiar with CakePHP, I decided to put together a book that can help people out. The result is "Refactoring Legacy Applications Using CakePHP".
With any web application framework, the most common questions are usually "how do I do X?" where X is usually a concept that is pretty common to web development work. I felt that the best way to show people how to move an older legacy application over to using CakePHP was to do exactly that. The book is a case study showed how I refactored an adminstrative application used in my simulation baseball league from a spaghetti PHP mishmash over to a well-structured CakePHP application.
The trick is to understand how to use CakePHP's conventions to your advantage, instead of fighting against them. In this book I cover things like
- Turning your database tables into models with relationships
- Better organization of code using "fat model, skinny controller" practices
- Understanding how to separate business logic from display logic
Here's what CakePHP lead developer Nate Abele had to say about the book:
Hartjes' book takes an in-depth look at pitfalls common to many legacy web applications, particularly those written in PHP. The application migration strategies presented make this an ideal read for developers new to MVC separation, database abstraction, and related concepts, as the one-to-one mapping between legacy and framework-oriented code turns abstract concepts into easily-digestable code examples.
We have a few reviews of the book as well:
- The book contains 61 pages and is interesting to read. Chris is humorous, but also firm about sticking to CakePHP best practices. It contains many examples of the legacy application and he shows you in detail how he implements it CakePHP. If you have a reasonable understanding of CakePHP basics this book is your next step in becoming a gourmet baker.
- So is the book worth your $10? Really $10 isn’t that much, especially for what you’re getting. I know the economy sucks right now and you’re probably trying to be smart about your money. Here’s the way I see it. In a year either the economy will be recovering/ed and everyone will be hiring CakePHP devs at which point that $10 will look like nothing next to the $250/hr we Cake devs pull down. OR society will have collapsed into a post-apocalyptic lawless cluster frak (with zombies) and money won’t have any meaning. Either way you win, right?
Throughout the book I also explain what I am doing, along with why I made the choices I did. I'm very happy with how it turned out and I think that if you buy this book you will not be disappointed. A few people have asked me for samples, so here is Chapter 5 of the book.
CakePHP is a registered trademark of the Cake Software Foundation
