Tag based languages - ColdFusion, CFUnit, mind shifts ... and TDD.

Earlier this week, I presented at the Maryland Cold Fusion Users Group on Test Driven Development (TDD).  Let's get this straight, I had never used ColdFusion before and I happily installed it at 8:30pm the night before the presentation.  I was really presenting on TDD so how hard could this ColdFusion stuff be anyway ... ?

The install went smoothly and provided links to live Code Snippets and extensive documentation (wouldn't be nice if a fresh VS.NET install pointed to the QuickStart Tutorials?).  I had already found CFUnit - what else would it be called??? - a free open source xUnit implementation for ColdFusion on SourceForge.  CFUnit was a simple install requiring a zip extract into the webroot of the ColdFusion server.  It also comes with a nice example that shows how to write test cases for a ColdFusion Component (CFC).

I decided to write something along the lines of the generic sorting routine that is able to sort objects and here is where things turned nasty.  It wasn't anything to do with the implementation or the platform just the mind shift that had to occur for my brain to begin processing in a tag-based environment.  It reminded me of my first experiences with some serious UNIX shell programming when coming from a programming language background.  Good shell programmers naturally think of everything in a executable-based model where they know how to call out to other executables to do all the work.  Simple things like string manipulation (which programming language people take for granted) can be tricky in these environments.  I struggled with shell scripting for this reason - firstly I needed to know all the executables available to do typical tasks and then I had to learn how best to interact with them.  The same quickly became apparent with ColdFusion - things like calling out to functions but still using the cfset tag and trying to figure out whether parameters could even be passed and then how to do it by value or by reference.  Admittedly, I started the night before with no prior reading or training - so the fact that I was able to become mildly proficient in a new environment and prepare my examples for the presentation is a great testament to the platform!

The presentation went very well and the audience seemed to appreciate that a .NET-er like me had taken the time to learn their platform to spread the TDD word.  One of the tricks of a good TDD presentation (if you haven't seen one) is to demonstrate the process.  You can't just show some code and talk about the xUnit API ... TDD is *process* and you have to demonstrate it.  Usually I can code up something in C# (or VB.NET) with confidence in front of an audience demonstrating various TDD techniques but I cheated with a few one liner code snippets this time as the syntax was still too new to me.

I was discussing the tag-based mind shift with John Morales (a newly minted Thycotic employee) and he pointed out that it sounded very similar to NAnt.  He's right!  It hadn't even occurred to me that the XML "build" tool shares many of the same ideas as ColdFusion.  NAnt does have tag-based processes and functions that are extensible.  NAnt doesn't have an app server, proper scoping or endless application frameworks but I will continue with the similarity anyway.  Maybe this is why some traditional programmers struggle when first getting into NAnt too?

What is your favorite tag-based language? (and no, HTML is not a language.)


Jonathan Cogley is the CEO and founder of thycotic, a .NET consulting company and ISV in Washington DC.  thycotic is currently working on a new product that will be launched later this month.  Our other product, myclockwatcher.com is a time and expense tracking system specialized for billable professionals built on ASP.NET, C# and SQL Server using Test Driven Development.


  • Hypertext Markup Language is not a language?

  • OK, OK ... so I meant "programming language" not "language".

    Thanks for the correction.

  • Favorite tag-based language? That would be ColdFusion! I came from a C / C++ / Java background and also had a bit of trouble adjusting to the tag-based syntax but I like the power of the language / tag library and enjoy programming in ColdFusion.

  • Jonathan, interesting perspective. I'll share that where you lament about "calling out to functions but still using the cfset tag", just know that you could have instead used CFSCRIPT, such as:


    In case your blog comments mechanism doesn't convert HTML/XML for display, I'll repeat that with html character entities:


  • well. i must say cf. i was an iHTML developer, and found cf, and now cfmx, and WOW. holy shnickeeees. its the best. its the fastest, and just plum great :)


  • If you've used ColdFusion before, you will say ColdFusion. I chewed a bit on old ASP, a bit of JSP and Java, but things realy took of with ColdFusion MX 6.1. CFMX7 has even greater features, and yes scscript is great.

  • sorry, that's <cfscript>.

Comments have been disabled for this content.