SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
ColdBox <3 Legacy App
IMPLICIT VIEW DISPATCH WRAPS YOUR APP IN COLDBOX
Your Host
‣ Scott Coldwell
‣ Developer at Computer Know How
‣ Houston, TX
‣ CF dev since 2006
‣ @scottcoldwell
‣ Define Implicit View Dispatch
‣ Practical steps to port your legacy app
‣ A vision for moving forward after porting
What We’ll Learn
Implicating a dispatched view…huh?
‣ In ColdBox, if a view file exists, it can be called
without a handler
‣ The handler/event are implicitly created
‣ The view doesn’t need to know anything about
ColdBox
‣ You could write an entire app with only views
‣ If you could write an entire app with only views, you can drop an existing
application into the views directory, and it would run*!
‣ * slight modifications may be necessary‡
‣ ‡ … are almost definitely necessary
‣ Good news: fairly straightforward
Drop in that legacy app!
‣ Make URLs compatible (index.cfm)
‣ Deal with Application.cfc/cfm
‣ Routes
‣ cfincludes, createObject, etc
Overview of Must-Dos
‣ Primary concern: index.cfm in ColdBox URLs
‣ ColdBox has URLs like this out of the box:
‣ http://myapp.com/index.cfm/user/account
‣ But your app probably had a URL such as:
‣ http://myapp.com/user/account.cfm
‣ NOTE: the .cfm extension is no longer necessary, but IS permitted
‣ To fix: Enable SES URL setting in CB; web server rewrite rules (see docs)
Must Do: URL Compatibility
‣ Coldbox is now the Application.
‣ Settings, environment variables, and other magic must find a new home
‣ May I recommend ColdBox settings and environments?
‣ Datasources, mappings, etc can be moved to ColdBox’s Application.cfc
Must Do: Application.cfm/cfc
‣ ColdBox auto-generates (implicitly dispatches) handlers and routes for
most cases
‣ You need custom routes for 2+ deep directories
‣ 	addRoute(pattern="/ajax/tags/:action", handler="ajax/tags");
‣ Use CLI tools to get a list for you
‣ find with mindepth option
Must Do: Routes
‣ Prepend all <cfinclude> template values with /?views/
‣ - <cfinclude template=“/widgets/top_nav.cfm”>
‣ + <cfinclude template=“/views/widgets/top_nav.cfm”>
‣ - myObj = createObject(“component”,”cfc.myCoolObject”);
‣ + myObj = createObject(“component”,”views.cfc.myCoolObject”);
Must Dos: cfincludes, createObject, etc
‣ CFC invocation: createobject ()-> getModel()
‣ WireBox
‣ Move settings and environmental settings to ColdBox.cfc
‣ Utilize Layouts
‣ Assign layouts to views in ColdBox.cfc
‣ empty layout
Overview of Should-Dos
‣ Use getModel() instead of CreateObject()
‣ easy search/replace
‣ Use WireBox inside of model objects
‣ + <cfproperty name="myOldCFC" inject=“model:myOldCFC">
‣ - <cfset foobar = createObject("component","myOldCFC").doSomethingAwesome() />
‣ + <cfset foobar = myOldCFC.doSomethingAwesome() />
‣ Consider how to handle the init() call, if applicable
Should Do: CFC invocation
‣ ColdBox has great settings management
‣ ColdBox has great environment management
‣ Use them
‣ Search/replace
‣ - application.mySpecialSetting
‣ + getSetting(“mySpecialSetting”)
Should Do: Settings, environments
Should Do: Layouts
‣ See if it makes sense for your app
‣ Control multiple layouts via Coldbox.cfc
‣ Special cases
‣ Blank layout for ajax responses
‣ Move static assets to /includes
‣ Move CFCs to /models
‣ Utilize Security interceptor
‣ Configure WireBox for models
‣ Use RC scope instead of form/url
Overview of Could-Dos
‣ New development can be ColdBoxy
‣ Refactor legacy code to be MVC using models, handlers, and views
‣ Tighter integration with ColdBox offerings: (e.g. LogBox, ForgeBox items,
etc)
Going forward
‣ Lay as much groundwork as you can, but get it out the door
‣ Search and replace (with regex) is your friend!
‣ Use a build process, not just source control
‣ Don’t take on too much at once! Port the app, then refactor
Final Notes
ColdBox all the things

Contenu connexe

En vedette

Star wars return of the jedi
Star wars   return of the jediStar wars   return of the jedi
Star wars return of the jedi
LucyAnne97
 

En vedette (16)

ITB2015 - Crash Course in Ionic + AngularJS
ITB2015 - Crash Course in Ionic + AngularJSITB2015 - Crash Course in Ionic + AngularJS
ITB2015 - Crash Course in Ionic + AngularJS
 
ITB2015 - Real Life ContentBox Modular CMS
ITB2015 - Real Life ContentBox Modular CMSITB2015 - Real Life ContentBox Modular CMS
ITB2015 - Real Life ContentBox Modular CMS
 
Description and Critique of Slideshare
Description and Critique of SlideshareDescription and Critique of Slideshare
Description and Critique of Slideshare
 
과제 3
과제 3과제 3
과제 3
 
get name
get nameget name
get name
 
Gentech
GentechGentech
Gentech
 
forces
forcesforces
forces
 
Nimmy digital text book
Nimmy digital text bookNimmy digital text book
Nimmy digital text book
 
Story book evaluation
Story book evaluationStory book evaluation
Story book evaluation
 
話題呼
話題呼話題呼
話題呼
 
Работа с подрядчиками
Работа с подрядчикамиРабота с подрядчиками
Работа с подрядчиками
 
Star wars return of the jedi
Star wars   return of the jediStar wars   return of the jedi
Star wars return of the jedi
 
CBDW2014 - Intro to ContentBox Modular CMS for Java and ColdFusion
CBDW2014 - Intro to ContentBox Modular CMS for Java and ColdFusionCBDW2014 - Intro to ContentBox Modular CMS for Java and ColdFusion
CBDW2014 - Intro to ContentBox Modular CMS for Java and ColdFusion
 
Center for Education on Social Responsibility (CESR) Introduction
Center for Education on Social Responsibility (CESR) IntroductionCenter for Education on Social Responsibility (CESR) Introduction
Center for Education on Social Responsibility (CESR) Introduction
 
Mood boards
Mood boards Mood boards
Mood boards
 
მუქარა
მუქარამუქარა
მუქარა
 

Plus de Ortus Solutions, Corp

Plus de Ortus Solutions, Corp (20)

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusion
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
 
ITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdfITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdf
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
 
ITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdf
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

ITB2015 - Migrating legacy applications to ColdBox MVC

  • 1. ColdBox <3 Legacy App IMPLICIT VIEW DISPATCH WRAPS YOUR APP IN COLDBOX
  • 2. Your Host ‣ Scott Coldwell ‣ Developer at Computer Know How ‣ Houston, TX ‣ CF dev since 2006 ‣ @scottcoldwell
  • 3. ‣ Define Implicit View Dispatch ‣ Practical steps to port your legacy app ‣ A vision for moving forward after porting What We’ll Learn
  • 4. Implicating a dispatched view…huh? ‣ In ColdBox, if a view file exists, it can be called without a handler ‣ The handler/event are implicitly created ‣ The view doesn’t need to know anything about ColdBox ‣ You could write an entire app with only views
  • 5. ‣ If you could write an entire app with only views, you can drop an existing application into the views directory, and it would run*! ‣ * slight modifications may be necessary‡ ‣ ‡ … are almost definitely necessary ‣ Good news: fairly straightforward Drop in that legacy app!
  • 6. ‣ Make URLs compatible (index.cfm) ‣ Deal with Application.cfc/cfm ‣ Routes ‣ cfincludes, createObject, etc Overview of Must-Dos
  • 7. ‣ Primary concern: index.cfm in ColdBox URLs ‣ ColdBox has URLs like this out of the box: ‣ http://myapp.com/index.cfm/user/account ‣ But your app probably had a URL such as: ‣ http://myapp.com/user/account.cfm ‣ NOTE: the .cfm extension is no longer necessary, but IS permitted ‣ To fix: Enable SES URL setting in CB; web server rewrite rules (see docs) Must Do: URL Compatibility
  • 8. ‣ Coldbox is now the Application. ‣ Settings, environment variables, and other magic must find a new home ‣ May I recommend ColdBox settings and environments? ‣ Datasources, mappings, etc can be moved to ColdBox’s Application.cfc Must Do: Application.cfm/cfc
  • 9. ‣ ColdBox auto-generates (implicitly dispatches) handlers and routes for most cases ‣ You need custom routes for 2+ deep directories ‣ addRoute(pattern="/ajax/tags/:action", handler="ajax/tags"); ‣ Use CLI tools to get a list for you ‣ find with mindepth option Must Do: Routes
  • 10. ‣ Prepend all <cfinclude> template values with /?views/ ‣ - <cfinclude template=“/widgets/top_nav.cfm”> ‣ + <cfinclude template=“/views/widgets/top_nav.cfm”> ‣ - myObj = createObject(“component”,”cfc.myCoolObject”); ‣ + myObj = createObject(“component”,”views.cfc.myCoolObject”); Must Dos: cfincludes, createObject, etc
  • 11. ‣ CFC invocation: createobject ()-> getModel() ‣ WireBox ‣ Move settings and environmental settings to ColdBox.cfc ‣ Utilize Layouts ‣ Assign layouts to views in ColdBox.cfc ‣ empty layout Overview of Should-Dos
  • 12. ‣ Use getModel() instead of CreateObject() ‣ easy search/replace ‣ Use WireBox inside of model objects ‣ + <cfproperty name="myOldCFC" inject=“model:myOldCFC"> ‣ - <cfset foobar = createObject("component","myOldCFC").doSomethingAwesome() /> ‣ + <cfset foobar = myOldCFC.doSomethingAwesome() /> ‣ Consider how to handle the init() call, if applicable Should Do: CFC invocation
  • 13. ‣ ColdBox has great settings management ‣ ColdBox has great environment management ‣ Use them ‣ Search/replace ‣ - application.mySpecialSetting ‣ + getSetting(“mySpecialSetting”) Should Do: Settings, environments
  • 14. Should Do: Layouts ‣ See if it makes sense for your app ‣ Control multiple layouts via Coldbox.cfc ‣ Special cases ‣ Blank layout for ajax responses
  • 15. ‣ Move static assets to /includes ‣ Move CFCs to /models ‣ Utilize Security interceptor ‣ Configure WireBox for models ‣ Use RC scope instead of form/url Overview of Could-Dos
  • 16. ‣ New development can be ColdBoxy ‣ Refactor legacy code to be MVC using models, handlers, and views ‣ Tighter integration with ColdBox offerings: (e.g. LogBox, ForgeBox items, etc) Going forward
  • 17. ‣ Lay as much groundwork as you can, but get it out the door ‣ Search and replace (with regex) is your friend! ‣ Use a build process, not just source control ‣ Don’t take on too much at once! Port the app, then refactor Final Notes
  • 18. ColdBox all the things