Ever so often an uber-geek Coldfusion programmer will ask me the question, "so.... what's your favorite Coldfusion tag?" It reminds me of a barfly asking "what's your sign". Nobody ever asks about my favorite CF function (I think I like "isValid( )" - very chic). As for my favorite tag, there are so many to choose from. Cfinvoke is a powerful, as is cfimport. Of course little actual work is ever done in CF without Cfquery. Cfcomponent and Cffunction earn high marks as well. But if you want to know my all time favorite tag I would have to say there are 2 tags that are more important and more useful than any other. In fact, I would say that the effective use of these two tags has made me into the Coldfusion Guru evangelist that I am today. If it wasn't for these 2 tags, people would not flock to my 72 Oldsmobile when I pull up at the quickie mart. I would not be able to afford that cubic zirconium ring I purchased for my lovely wife - and the Hottentots would just seem un-hot. Let me just step into the pulpit and tell you about them.
(Note: I've been sick and taking medication so please forgive me for the following)
Every day in every way Cfabort gets better and better. When an error raises its ugly head - cfabort. When a query is misbehaving - cfabort. When compilation causes agitation....when request execution causes disillusion... when a relocation destination causes consternation - cfabort. When you can't figure out why variable A is true and variable b is false and variable c does not exist in God's entire universe... I say unto you - Cfabort (can I get an Amen). Yes my friends... my brothers and sisters... Cfabort is not just a tag. It is not just some tag. Cfabort is the tag. It is the way to Cfsalvation (halleluiah!).
(Mopping brow) I am amazed... I am astounded... can I say I am flummoxed and even bamboozled (with apologies to Brother Malcolm) at the lack of understanding of this wonderful tag. How does anything get debugged without Cfabort. My friends, I have stood at the bedside of a dying CF application and watched as CF doctors try to bring it back to life and I can say to you without reservation that it cannot be done without the power of Cfabort. You can run requests over and over again. You can change form variables, recycle the services (except the 8:30 service - that one is kind of a holy cow around here), edit the database and even go so far as to rename the template... but until you Cfabort you are headed for destruction. So I say to you my dear friends and muse readers. Go forth and Cfabort. As you develop, add the tag at will and stop your executions. Examine your code and variables and learn what is happening within your request. Then you will know the meat and not just the milk of Coldfusion.
Now I must hasten to say that while Cfabort is a powerful tag - it must be used in conjunction with another, equally powerful tag. Without the 2 tags working together you will be like a football player without his pads, or a golfer without his clubs, or a rocket scientist without his... his ... head. No my friend, just Cfabort is not enough. You will also need - cfdump.
With Cfdump we can do more than just expect... we can introspect. We can do more than surmise. We don't have to compromise. We can see the inner workings of the most complex of objects. It could be a simple string or a mighty query or even (do I dare to say it) a immensely complex component - Cfdump can bring it to it's knees! Cfdump can handle java objects, Com objects, functions, and tags. It is the king of the debugging tags. It is the yin to the cfabort yang. Cfabort might plant the seed ... but it is cfdump that waters the seed and cfdump that provides the increase. Let us not dump upon fallow ground. Let us arise and go forth and dump the variables that cry out for dumping!
Actually, I really do use these 2 tags almost daily. I often participate in debugging sessions with novice and even intermediate to advanced Coldfusion programmers. I am continually astounded by the lack of understanding I see toward what is actually going on in a page. When facing new code for the first time I often start at the top of a template (or the application.cfm or even application.cfc file) and add aborts and dumps - working my way down to the meat of the application. This simple process tells me a great deal about what the page is supposed to do. When approaching a bug I sometimes work backwards, from where the bug occurs (if that can be determined) back to the beginning of the request. When troubleshooting components, I often interrupt a method call and dump out the state to see what is being passed in or about to be passed out.
One more useful tip regarding debugging an application. I spend a good deal of time examining the debugging information so usefully provided by the CF server at the bottom of the page. This information can often tell you everything you need to know about bottlenecks and query results. My personal belief is that CF developers sometimes avoid the debug information and avoid Cfabort and cfdump because it "breaks" the page. Perhaps it's a legacy of so many of us coming from being web designers or HTML professionals. The debug and cfdump don't provide us with the "visual" result we are looking for. They seem like a step backward. But they are not a step back. They are, in fact an essential part of troubleshooting and debugging. Failing to use them will triple and quadruple the time it takes to debug a complex application (if you can debug it all).
So here's to Cfabort, Cfdump and the ugly debug info at the bottom of the page. Long may they live in our hearts and in our development - and may Ben Forta and Ray Camden bless our Cfefforts.