Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dragging Old Frameworks Into the Future With Limited Kicking and Screaming

Dragging Old Frameworks Into the Future With Limited Kicking and Screaming

Joe's career has been filled with legacy projects he's been tasked with bringing into the modern PHP world. He'll share experiences specifically with refactoring a Kohana framework project and the steps his team is taking to modernize the code base while introducing new features and continuing to deliver releases for their customers. Join us as we learn about dragging old legacy projects into the future of modern PHP development without much kicking and screaming.

Joe Ferguson

May 31, 2018
Tweet

More Decks by Joe Ferguson

Other Decks in Programming

Transcript

  1. Who Am I? Joe Ferguson PHP Developer PHP Architect @

    Ministry Brands Twitter: @JoePFerguson OSMI Board Member Drone Racing Pilot
  2. Initial Project Overview Is there a framework? Is there a

    coding standard? Is there any autoloading? How are dependencies behind handled? Is there an ORM or how is the database being utilized? Is there a development environment?
  3. Why not rewrite? Progress halts entirely Business logic is rarely

    reused Most of the time is getting back to current functionality
  4. Existing Tests This is great! Review the tests to get

    an idea of coverage Passing tests become your control for any upcoming changes Confidence++
  5. No Existing Tests Not the end of the world! Inspect

    the code base, was it written to be easily testable? Could you easily mock dependencies?
  6. Untestable Code Not all code is testable If you can’t

    easily unit test the code base, consider alternatives Functional testing and Acceptance testing are valid options
  7. Acceptance Testing NOT a replacement for Unit Testing Test large

    parts of your application at a time Can be harder to pinpoint error location Gives large code coverage in short amount of time
  8. Digging into the Code Code Consolidation Replace globals with Dependency

    Injection Write tests Extract SQL (to ORM or other)
  9. Digging into the Code Code Consolidation Replace globals with Dependency

    Injection Write tests Extract SQL (to ORM or other) Extract Business Logic (To domain logic)
  10. Digging into the Code Code Consolidation Replace globals with Dependency

    Injection Write tests Extract SQL (to ORM or other) Extract Business Logic (To domain logic) Extract Presentation Logic to Views (Twig, Blade, etc)
  11. Digging into the Code Code Consolidation Replace globals with Dependency

    Injection Write tests Extract SQL (to ORM or other) Extract Business Logic (To domain logic) Extract Presentation Logic to Views (Twig, Blade, etc) Extract Action Logic (To Controllers)
  12. Digging into the Code Code Consolidation Replace globals with Dependency

    Injection Write tests Extract SQL (to ORM or other) Extract Business Logic (To domain logic) Extract Presentation Logic to Views (Twig, Blade, etc) Extract Action Logic (To Controllers) Write (more) tests
  13. Resources / Q & A Modernizing Legacy Applications In PHP

    - Paul M. Jones https://leanpub.com/mlaphp Minimum Viable Tests - Chris Hartjes https://leanpub.com/minimumviabletests Code Style https://github.com/FriendsOfPHP/PHP-CS-Fixer, http://editorconfig.org php mess detector https://phpmd.org Autoloading PSR-4 https://getcomposer.org/doc/01-basic-usage.md ORMs http://www.doctrine-project.org http://propelorm.org Docker https://leanpub.com/dockerfordevs, Vagrant https://puphpet.com