060 Migrating legacy CFML to MVC (Model View Controller) with Nolan Erck
from ColdFusion Alive
Nolan Erck talks about "Migrating legacy CFML to MVC (Model View Controller)" in this episode of the CF Alive Podcast, with host Michaela Light. Show notes What exactly is legacy ColdFusion? A broad term Non-framework code Might use CFIncludes or some CFCs to be modular Even giant 10k lines of code Self-posting forms What the MVC design pattern is and what problems it solves MVC = Model View Controller Model = biz logic and SQL View = front end UI - HTML, CSS, JS Controller = the glue that holds the Model and View together and says which part calls which Customer in a restaurant ordering from a Menu (View) from a Waiter (Controller) to make the food in the kitchen (Model) Maintenance easier Whack a mole bugs Biz logic, HTML, JS and SQL all mixed up together Bit rot/Technical debt Hard for designers to edit the code as the HTML is mixed up Merge conflicts Hard to fully test Manually testing Duplicate code, unused code (deadwood) Specialization of labor UI experts CF developer SQL database engineer How the FW/1 and ColdBox frameworks use a convention-based approach to bring consistent structure to an application Both are modern MVC Use folder to separate the three parts, file naming conventions FW/1 is minimalist, one file, easy to get started MuraCMS uses it ColdBox is heavyweight with more features and add-on packs in the Box ecosphere Testing Caching Etc Ortus supports Other MVC frameworks that are not as maintained CFWheels - These are convention based frameworks Fusebox - XML config file framework Mode Glue - XML config file framework Mach-ii - These are convention based frameworks What Dependency Injection (DI) is, how it simplifies the "model" portion of applications, and how they are used in FW/1 and ColdBox Keeps your objects organized Tools DI/1 Wirebox We did a whole interview on this topic in another episode of CF Alive DRY = Don't Repeat Yourself DI and MVC are independent How to refactor real-world procedural code into MVC-style code What code belongs in the model, the view, and how the controller ties the two together. Cut parts out of giant file to include files Move out the SQL and CF logic Dedup similar code Move out the front end code to View include files Start running with the remaining code in the View Strategies for migrating large applications in phases. ColdBox legacy tool feature Version code such as Git 2 branches Legacy MVC Maintain both AB test each branch All URLs will change Using CommandBox and Git to spin up on-demand instances of ColdFusion and manage our code. CommandBox command line CF Instant server setup or config Any version, Adobe ColdFusion, Railo, Lucee CFML Tool costs FW/1 free ColdBox free, pay or training and support CommandBox - free Git free to paid Source Tree - free Sublime Text - free to shareware paid $35 CF Builder free 30-day trial, $300 Why are you proud to use CF? WWIT for you to make CF more alive this year? What did you enjoy at CF Summit? Nolan's CF Summit workshop description Do you maintain legacy ColdFusion applications, perhaps written with old procedural-style code? Have you been told you should be using a Model-View-Controller (MVC) framework but don't really understand how that works? Does the idea of rewriting the entire application seem like an impossible task? What if you could instead revamp your code in phases, without having to do it all at once? Come to this workshop and learn: What the MVC design pattern is and what problems it solves How the FW/1 and ColdBox frameworks use a convention-based approach to bring consistent structure to an application What Dependency Injection (DI) is, how it simplifies the "model" portion of applications, and how they are used in FW/1 and ColdBox How to refactor real-world procedural code into MVC-style code Hands-on portion of the workshop will: Analyze and deconstruct a simple procedural application to see what code belongs in the model, the view, and how the controller ties the two together. Move the code into the appropriate MVC layers and test it. Discuss strategies for migrating large applications in phases. Use CommandBox and Git to spin up on-demand instances of ColdFusion and manage our code. This workshop will help anyone with a moderate skill level in ColdFusion, and at least some familiarity with object-oriented programming concepts. It will be a Bring-Your-Own-Laptop session. Prior to the CF Summit we will provide links and instructions to download and install CommandBox and the sample application code. Mentioned in this episode MVC FW/1 ColdBox Dependency Injection, why is it awesome and why should I care? with Nolan Erck Kishore CF Summit East episode Adobe CF Summit (Las Vegas) OrtusSolutions BlueRiver DI/1 Wirebox CommandBox Git episode Sublime Text CF Builder Convective CF tuning guide Bring Order to the Chaos: Take the MVC Plunge Bio Nolan Erck has been developing software for 19 years. Starting in the video game industry working on titles for Maxis and LucasArts, then advancing to web development in 1999, his list of credits includes Grim Fandango, StarWars Rogue Squadron, SimPark, SimSafari as well as high-traffic websites for clients. Nolan manages the SacInteractive User Group, teaches classes on aspects of software development, and regularly gives presentations at conferences and user groups across the country. He is also Chief consultant at South of Shasta
Embed this episode
No transcript yet.