I've actually been working on a very similar project -- converting a medium-size procedural site to Mach-ii without breaking existing code.
Depending on your implementation, there are a few paths you could follow. One potential route is to simply treat your existing legacy templates as views within the Mach-ii application. It's dirty, doesn't obey the tenets of the framework, and will likely lead to duplication of code and effort, but it'll probably work without too much kluginess. One thing I've done is break out the site-wide features like user authentication, password updating, etc and start with them. Treating the Mach-ii application as kind of a "gateway" to the rest of the site allows you to build up an application that can authenticate a user, and then point them to either existing legacy code or to new awesome refactored Mach-ii goodness. In the process, I took the procedural cfm file that previously handled user validation and authentication, and converted it to Mach-ii (along with the other template included on every page in the site which handled on-going authentication checking). I then hollowed out those templates and rewrote them by "faking" a Mach-ii event at the top of the template (to make the template "think" it was inside a Mach-ii app) and reproducing their logic with calls to the Mach-ii listeners and through to the service layer to check authentication settings. So the framework just works because it knows how to hit the authentication events. And the legacy code works because it includes procedural code that's been faked into thinking it's Mach-ii code. Eventually, the kluges inside the listeners to use <cflocation>s instead of <redirectEvent()>s go away, because your entire site has been refactored and you no longer need the hooks to the legacy section of the site. As of this email, it's still a work in progress -- code has not yet gone to production -- but it's functioning pretty well in our dev environment and the refactor is moving forward. The biggest benefit, however, is that the refactor goes forward at its own pace and both new and old code continue to function....ideally we'd have three years just to rewrite the entire site, but we all know how likely that is ;-) --Joe On Mon, Feb 7, 2011 at 10:22 AM, Jacob <[email protected]> wrote: > Hello Folks, > I've been researching and playing with Mach-II since December of last > year. So far I like everything I've seen, and have gotten a working > prototype working in our test environment. We have gotten "permission" to > use Mach-II but are still waiting on "approval", being in a corporate world > isn't great for coding sometimes :) > > Our current app is around 500 templates strong, using an Application.cfm > template. We are going to be doing a complete rewrite, to get the code away > from tags which were deprecated in Internet Explorer 4. As we do this > transition, we want to take the CF code and turn it into Mach-II code. We > won't be able to rewrite the complete app and release it all at once, which > would be the best/easiest/safest/etc. solution I believe, so we will need to > be able to release small parts of Mach-II code into our currently > procedurally programmed application until we get the entire thing > rewritten. > > What's the best way to accomplish this? We obviously don't want to break > the production application, but we want to begin releasing updated code as > soon as possible. Once we extend the Mach-II framework, is it possible to > execute our current app without converting the entire app to Mach-II with > one release? > > -- > Come see Team Mach-II at OpenCFSummit - Feb 21-23, Dallas, TX - > http://www.opencfsummit.org/ > > To post to this group, send email to > [email protected] > For more options and to unsubscribe, visit this group at > http://groups.google.com/group/mach-ii-for-coldfusion?hl=en > > SVN: http://svn.mach-ii.com/machii/ > Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ > -- ------------------------ Joe Bodell [email protected] (c) 952-465-5096 -- Come see Team Mach-II at OpenCFSummit - Feb 21-23, Dallas, TX - http://www.opencfsummit.org/ To post to this group, send email to [email protected] For more options and to unsubscribe, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
