I use cftry/cfcatch to handle events that are out of my controls such as accessing filesystem, calling third-party APIs, and so on.
Try to use existing frameworks such as Fusebox, ColdBox, CFWheels because the mechanism to handle errors is already built-in.
I've had a lot of people telling me to use frameworks. As a person with a non-traditional upbringing into coding, I've found all their websites to be equally confusing as to explaining what they are, and how to get started with them. They seem to equally assume you know vast amounts of ColdFusion's most advanced syntax and code, and the way they present their framework has been confusing at every turn.
Like how CF was so much easier to pick than Java or .NET, I was hoping a framework would simplify my web applications, but instead, they seem to be mired in an advanced OOP methodology (which chances are, IS the way to do programming, but isn't where I am yet, so I'm having a hard time comprehending it)
I guess I need to start somewhere. I think if I can find a website that doesn't a better job teaching than the framework's website (who are notorious for documentation that talks well beyond me and a lack of systematic tutorials to get me acclimated to using the system).....that might help me get my feet wet.
1 person found this helpful
Let me share my experience. I had the same issues with frameworks as you described above. Some frameworks, such as Mach-II and ColdBox. They use a lot of technical terms that way above my head. However, there are frameworks like Fusebox and FW/1 that give us minimum learning curves.
My favorite is Fusebox 5.x which I can use in either OOP or non-OOP approach. At first, I used it to separate logic from the view. As my ColdFusion and programming skills developed, I started OOP. It provided me a smooth transition.
Using framework, I can spend more of my time to "what to build" instead of "how to build." And, it does simplify mechanism of applications. Let say, in Fusebox, there is a something wrong with adding items in shopping cart. I can quickly pin point where I should look for the problem.
Hmm. Thanks for that info, p. sim.
One of the things I'm adamount about with a framework solution is that:
a. It allows me to maintain my own URL format., ie, I can use domain.com/apples/oranges or domain.com/blog/this-is-an-article/comments rather than it forcing functionality into the url like domain.com/files/functions.cfm?do=that. I mean, it's one thing if I can call functionality in the framework with an AJAX or other "behind the scenes" HTTP request, that's fine. But when it comes to the user seeing the URL in the address bar, I want that to be all me.
b. It allows me to have my own directory structure for where I put files. Though I understand that MVC in its very nature is about separation of logic, presentation and data (and I'm fine with that), it would need to support my naming structures for the application's directories.
I've heard about Fusebox the most, and in the few CF job postings I've seen, when they mention framework familiarity, they usually list Fusebox as the preference. I do like your line on spending time on what to build than how to build.
Can you recommend a good place to learn Fusebox? Their website seems to suffer from what I call "Developer-itis", where it's not necessarily being presented in an easy to consume manner (though I understand that's a subjective statement). Fusebox seems like something well worth learning since it can optimize my build process.
a. In my case, I use URL Rewrite; and this depends on the Web server.
b. Most frameworks already have their own directory structure, but there are some flexibility which we can do directory mappings.
Fusebox is one of the oldest frameworks. A lot of legacy apps still use Fusebox 3.
Recommended books for learning Fusebox:
- Discovering Fusebox 3 with ColdFusion by Hal Helms and John Quarto-vonTivadar (May 10, 2002)
- How to Drive Fusebox 5.5 by Jeff Peters (Sep 1, 2008)
Once you are comfortable with a framework, you will love it; and never go back to non-framework way.