Home > .NET User Groups, Software Development, TDD, Test Driven Development > Tag based languages – ColdFusion, CFUnit, mind shifts … and TDD.

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 alreadyfound CFUnitwhat else would it be called??? – a free open source xUnit implementation for ColdFusion on SourceForge. CFUnit was a simple install requiring a zipextract 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 languagebackground. 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 aboutthe xUnitAPI … 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 isthe 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.comis a time andexpense tracking system specializedfor billable professionals built on ASP.NET, C# and SQL Server using Test Driven Development.

  1. http://
    October 13, 2005 at 6:00 pm

    Hypertext Markup Language is not a language?

  2. Jonathan Cogley
    October 13, 2005 at 6:31 pm

    OK, OK … so I meant “programming language” not “language”.

    Thanks for the correction.

  3. Sean Corfield
    October 23, 2005 at 1:00 am

    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.

  4. http://
    October 23, 2005 at 3:33 am

    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:

    x=myfunction();

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

    <CFSCRIPT>x=myfunction();&lt/CFSCRIPT>

  5. charlie arehart
    October 23, 2005 at 3:44 am

    Jonathan, one other thought: as long as you, a .NET maven, are discussing CFML (the language you write in when running on ColdFusion), I’d like to point out that there’s now a native .NET implementation of CFML–not from Macromedia but from New Atlanta.

    The product is BlueDragon, and it opens CFML pages to many of the benefits of ASP.NET. CFML pages are processed in the same pipeline as ASP.NET (BD is implemented as an HttpHandler for requests to .cfm and .cfc pages), so they honor such things declarative security mechanism in the web.config, processmodel limiter mechanisms in the machine.config, etc.

    Of course, it also opens the door to tight integration between CFML and ASP.NET, with shared session and application variables, ability to include back and forth between the two, and more. Perhaps most compelling is the ability to call .NET objects from within CFML (natively, not as web services), and BlueDragon marshals a returned Datatable so it can be processed like a CFQUERY resultset in the CFML, and lots more.

    If you’re interested in hearing more, drop me a note at charlie (at) newatlanta.com or see http://www.newatlanta.com/bluedragon/. Yes, I work for the company and am evangelist for the product. I hope you (and other readers) will pardon the seeming sales pitch. It’s just that it’s a very unique solution that most still don’t know about, would never look for, and certainly wouldn’t hear about from Macromedia or those who know only of their solution for running CFML.

    Since CFMX runs on J2EE, we spend as much time evangelizing .NET and its many benefits to CFML folks, as we do distinguishing BD from CF. We also point out how, for many, .NET simply proves to be a better and more performant platform for executing CFML. Hope that’s helpful.

  6. tony of the weeg clan
    October 23, 2005 at 6:32 am

    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 🙂

    tw

  7. Stefan
    October 25, 2005 at 6:12 am

    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.

  8. Stefan
    October 25, 2005 at 6:15 am

    sorry, that’s .

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: