Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Itb2018 integrating mvc into legacy

64 views

Published on

Brad Wood

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Itb2018 integrating mvc into legacy

  1. 1. Integrating MVC into legacy There is hope yet
  2. 2. The State of Your App ● What does your app look like? ● Using other frameworks? ● Partially converted to Coldbox? ● What are your goals?
  3. 3. Reasons to migrate to a modern framework ● Code organization ● Devs are all using the same organization and patterns ● Consolidated functionality like logging, caching, tier detection ● Regular updates ● Makes your dev shop more attractive to prospective employees
  4. 4. Gotcha’s ● You still have to write code ● Not a silver bullet ● Don’t try a full 100% rewrite ● Baby steps are better than trying everything new at once ● Refactor refactor refactor ● The pilot system (write a throwaway test)
  5. 5. Install ColdBox ● Environment (tier) detection ● Can use legacy checks for environment ● It’s ok for the ColdBox config to reference old application variables ● It’s also possible to find/replace legacy code to use ColdBox settings!
  6. 6. Application.cfm -> Application.cfc ● Watch out for transcendent variables scope ○ Use onRequest() if needed function onRequest( targetPage ) { variables.mySetting = “myValue”; include arguments.targetPage; }
  7. 7. Add in ColdBox bootstrap ● ColdBox is always loaded ○ onApplicationStart() ● You get to decide what requests will be processed by ColdBox ○ onRequestStart()
  8. 8. Create a Layout ● Convert your main layout ● Reuse as much as possible via includes ● This will let you start converting views
  9. 9. Start plugging in ColdBox aspects ● Proactively convert legacy: ○ Logging -> LogBox ○ Caching -> CacheBox ○ CFC creation -> Wirebox ● This can happen outside of ColdBox!
  10. 10. Pick a site area to start ● Maybe something simple like login ● Move .cfm pages into a view ○ Implicit view dispatch ○ Swap out build links calls
  11. 11. Handle external URLs ● Just change them and have people update bookmarks ● Put in URL rewrites at the web server level ● Put in routing in your Application.cfc to re-route to ColdBox
  12. 12. Shorten your feedback loop ● When you have a part of the app working, test it and RELEASE IT! ● Don’t try to save up and do a huge chunk. You’ll never finish! ● Use this as an opportunity to do script conversion, etc but don’t get bogged down ● Employ group code reviews to discuss conventions and stay on the same page ● Make sure you update your product owner so they know about your progress!
  13. 13. Legacy/ColdBox App Demo ● https://github.com/bdw429s/coldbox-legacy-app-demo ● Clone repo and start server ● Each page tells you how it works ● Half of the demo site runs legacy .cfm files ● Half of the demo site runs ColdBox handlers

×