ColdFusion: Final Exam

Suppose, dear reader, that you teach a class in ColdFusion. You would have to give an exam to test your students’ absorption of the material. As Adobe does for its CF certification, you would probably give a written exam, asking esoteric questions about tags and attributes and data structures.

If you had even the smallest fragment of a soul, you would feel a little bad as you saw how hodge-podge the language has evolved over the years, leading to attributes like var, variable, and name which all do the same thing.

Me? I take it one step beyond. My students take a written exam, but they also take a practical exam. That practical exam? It looks a little like this:

Full Sail University's "Advanced Server-Side Languages" final (practical) exam

Which is a prettier way to say:

  1. Implement a component studentFinal.cfc,

  2. which inherits from the (given) utility component Exam.cfc,

  3. implements the (given) 13-function interface IFinal.cfc,

  4. passes the (given) test suite finalExam-Spec.cfc,

  5. and ties all together to produce a single PDF file via a function in the (given) base class.

Yep, you read that right: the test grades itself, thanks to cfSpec, so the student knows exactly how far they’ve gotten as they work through the exam. Of course, I have my own test suite with different input data to ensure that no one is coding to make the tests go green (not that any coder has ever done such a thing). The only way to get a perfect score is to produce the correct PDF at the very end, which relies on every function in the exam component working correctly.

Irony of ironies: the reference implementation (a.k.a. key) is 210 lines of code. The test suite is well over twice that.

Seriously though, how else would you implement a practical exam for ColdFusion, amirite?

By Rick Osborne

I am a web geek who has been doing this sort of thing entirely too long. I rant, I muse, I whine. That is, I am not at all atypical for my breed.