O'Reilly logo

Modernizing Legacy Applications in PHP by Paul M. Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Extract Action Logic to Controllers

Thus far, we have extracted our model domain logic and our view presentation logic. Only two kinds of logic remain in our page scripts:

  • Dependency logic, which uses the application settings to create objects
  • Action logic (sometimes called business logic) which uses those objects to perform the page actions

In this chapter, we will extract a layer of Controller classes from our page scripts. These will handle the remaining action logic in our legacy application separately from our dependency-creation logic.

Embedded action logic

For an example of embedded action logic mixed with dependency logic, we can look at the ending example code from the last chapter in Appendix G, Code after Response View File

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required