Matthew, It sounds like there have been a lot of good suggestions here, but I wanted to throw out my two cents because I have been working on incremental refactoring of spaghetti code for over a year now.
I really wanted to apply a framework, and personally, I favor Mach-II; but having done both the mega-rewrite where I have applied the framework, separated everything into CFCs, added ColdSpring for bean management, etc...; and having done several other much smaller refactorings, I recommend following the suggestion of just starting to move reusable code into CFCs. In several recent cases, I created some query-only CFCs that were just wrappers to the queries in my app and I created a few function library CFCs as well. But for me, the most important gain came from adding ColdSpring to every app - whether it was spaghetti code or had a framework under it. Add your CFCs to the bean factory and start from there. You don't have to change much - only where you rely on your CFCs for information do you need to add in the code to get that bean and invoke the appropriate method. Everything else stays in tact. You reduce the total lines of code in your app and increase it reliability by not having the same (or often worse, *almost the same*) query or algorithm coded in 6 places across different templates. In some cases, just having all of my reusable code -especially queries- in ColdSpring satisfied the urge to burn an app to the ground and completely rebuild. It is amazing what a little bit of organization can do to improve your attitude about maintenance. -Chris On Feb 3, 10:37 pm, Matthew <[email protected]> wrote: > Hi guys > > I'm retro fitting a spaghetti code application to OOP. I'm doing it a > piece at a time (as I work on a section of the website I take some > extra time to migrate it to OOP). Because I'm slowly doing it I can't > use a framework until everything has been migrated (also because I > don't want to de-stablise the app too much). > > I'm taking care to seperate my MODEL from the VIEW / CONTROLLER so > that when I do bring in a framework it will be easy to plug it in. For > now I have to retro fit the spaghetti code to use the MODEL so I'm > attempting a very basic "framework" where by I load all the classes / > objects into the application scope when the app starts e.g. > application.beanBaket = CreateObject("component","app.beans.basket"). > > This works fine for objects/classes which don't store data however > with say for example a "basket" bean where you need to store data per > session I need to be careful not to update the application version so > would it be best to do something like session.basket = Duplicate > (application.beanBasket)? > > If anyone has tips on retro fitting that would be great! > > Cheers > Matthew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
