Matthew,
I'm only guessing here, but it doesn't sound like you have ColdFusion
8 running on your server. If that's incorrect, well, the answers get
even easier! :)
If I were you I'd create a separate development environment, move the
site into Fusebox, deploy the frameworked version (with either an
ISAPI URL rewriter or onRequestStart(), onRequest() and
onMissingTemplate()), and then start messing with the model. OOP isn't
as important as encapsulation and cohesion which can be done even with
an essentially procedural framework like Fusebox.
Moving a procedural app to Fusebox isn't all that hard, really (you're
just chopping your cfm files into smaller chunks and wiring them
together with the config file), and it's a lot easier and faster than
moving from procedural to OO. If you want OO, do it only after you've
gotten the rest of the site under control, otherwise you're really
only making a big problem into a huge problem.
Your best friends in this case will be:
Application.cfc for the sake of:
onApplicationStart() to load up the application scope (which you're
already doing but onApplicationStart() is so tidy)
onRequestStart() and onMissingTemplate() to route requests for the old
filenames to Fusebox fuseactions... also could be a great place to use
mod_rewrite or the IIS equivalent
onSessionStart() for doing <cfset session.cart =
createObject(...).init() />
onSessionEnd() for saving unfinished cart info to a DB for later (what
you might call a "value added feature" because it's fairly simple and
bring a lotta bang)
Many huge performance and code updates.
So, to recap:
a) switch the application over to Application.cfc. You _are_ running
at least ColdFusion 7, right?
a.1) Upgrade the site to CF 8
b) use onSessionStart() in Application.cfc, create a cart object in
the session using createObject().
b.1) If CF8 is not available and is out of the question, change jobs.
Err, I mean do
<cfif not structKeyExists(session,"cart")>
<cflock scope="session" type="exclusive" timeout="10>
<cfif not structKeyExists(session,"cart")>
<cfset session.cart = createObject(...).init() />
</cfif>
</cflock>
</cfif>
c) Move the site to fusebox to get the architecture under control and
THEN start messing with the implementation.
Just my advice, YMMV. :)
J
On Feb 3, 2009, at 10:37 PM, Matthew 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). ...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---