Purchased the book on Amazon.com or received a free copy at a user group or conference? Click here to create your account!

Home » Books » Refactoring Legacy Applications Using CakePHP

Refactoring Legacy Applications Using CakePHP

By: Chris Hartjes
Publication Date: June 1, 2009
Price: $13.00
Pages: 83
Category: PHP

Have you ever wanted to start using the CakePHP web application framework, but were wondering about its 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.

Description

Have you ever wanted to start using the CakePHP web application framework, but were wondering about its 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.

About the Author

Chris Hartjes has been building web applications of all shapes and sizes and since 1998, ranging from small personal blogs to large-scale adult dating web sites. Currently employed as a Software Engineer for XML Team Solutions building web applications for use with sports data, he enjoys speaking at conferences and tries to share what he's learned via his blog.

He lives in Milton, Ontario, Canada with his long-suffering wife, two kids and two cats.

Table of Contents

Chapter 1. Understanding Models

  • Turning Tables Into Models
  • Model Associations
  • No Auto-incrementing Primary Key
  • Updating Denormalized Data
  • Removing Cached Data Upon Record Deletion
  • Making Your Models Behave: Behaviors
  • Request Routing

Chapter 2. Creating Controllers

  • Determining Controller Names
  • Linking Models to Controllers
  • Components For Your Controllers

Chapter 3. Layouts

  • Setting Character Sets
  • Setting Page Titles
  • JavaScript Usage
  • Actual Content
  • CSS
  • META Content

Chapter 4. Separating Business Logic From Presentation Logic

  • Helpers for Your Views

Chapter 5. Untwhirling the Spaghetti

  • Fat Models, Skinny Controllers
  • Hopelessly Twisted
  • Easy Drop-Down Lists
  • Model Association Tweaking
  • Multiple Select Drop-Downs

Chapter 6. Refactoring Multiple Record Editing

  • Simplified Views
  • Filtering and Updating Records
  • Only Updating the Data You Need To

Chapter 7. Easy Batch Record Manipulation

  • Using N.field Notation In Your Forms

Chapter 8. Easy Batch Record Addition

  • Easy Arrays in Forms
  • Saving and Validating Data

Chapter 9. Displaying Data Simply

  • Simple Data Collection for Display
  • Grouping Display Output By Criteria
  • Business Logic Where It Belongs

Chapter 10. Playing with Date Ranges

  • Real World Date Forms
  • Date Form Automagic

Chapter 11. Wrapping It All Up

Videos

Refactoring Legacy Applications Using CakePHP includes access to the following 3 videos.

TitleDuration (minutes)
An Introduction to Relational Databases 07:47
Database Normalization: the First Three Rules 06:35
Introducing the mysql Client 18:01

Supplements

Refactoring Legacy Applications Using CakePHP includes access to the following supplements.

TitleType
Refactoring Legacy Applications Using CakePHP (E-Book) PDF
Chapter 5 - Untwhirling the Spaghetti Supplemental Chapter


 Join 700+ subscribers!


Have a question? Contact us!

The Community Firehose

News submitted by and about the PHP and Web development community.

Creating a Weather Forecast with PHP and the Google Weather API
Submitted by wjgilmore

How to Create an Image Gallery Powered By PHP and Picasa
Submitted by wjgilmore

Easy Databasing with SQLite
Submitted by wjgilmore

PHP IDE Roundup
Submitted by wjgilmore

Five Cool PHP Array Functions
Submitted by wjgilmore

Use jQuery with Greasemonkey
Submitted by wjgilmore

Encapsulation in PHP
Submitted by wjgilmore

Talking to Google Charts with PHP
Submitted by wjgilmore

Talking to Google Analytics with PHP
Submitted by wjgilmore

Building a jQuery/PHP-powered Chat Room
Submitted by wjgilmore

Cloud Computing with PHP
Submitted by wjgilmore

BattleMaster: A Web-based game written in PHP
Submitted by wjgilmore

Create an Image Rotator with CSS and jQuery
Submitted by wjgilmore

Submit News | News Archive

Copyright © 2009 W.J. Gilmore, LLC. All Rights Reserved. Purchase Policy · Privacy Policy
Trademarked names may appear on this website. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to no benefit of the trademark owner, with no intention of infringement of the trademark.