TechForge

25th September 2012

Share this story:

Tags:

Categories::

By Tom Barker, co-author of Foundation Website Creation with HTML5, CSS3 and JavaScript (Apress, 2012) and author of soon to be released JavaScript Performance: Monitoring and Visualization (Apress, 2012)).

If you program exclusively in JavaScript, you haven’t been able to incorporate test-driven development (TDD) into your process until about a year ago. That’s when unit-testing frameworks – my favourite is Jasmine, developed by Pivotal Labs – became available. Is it worth altering your coding habits and practices to take advantage of this feature?

TDD is a methodology that involves writing a unit test describing the smallest piece of testable functionality of your application. Essentially, a suite of unit tests is documentation that your application works. Having this documentation makes the application’s overall functionality easier for new team members to understand.

And if you or other developers create an update that interferes with this functionality – the unintentional breaking of what you already have – then TDD will let you know. In short, not using TDD typically means a higher error rate and code fragility.

TDD’s long-term benefits are undeniable. But at the front end, these unit tests insist that code be written in testable small, self-contained and modular pieces. And it’s a given that not all developers will want to alter their work habits.

Although the community of JavaScript developers hasn’t yet fully embraced downloading TDD-enabling frameworks, I suspect there’ll be a lot more buzz about these tools over the next year or two.

If you’re a JavaScript developer and TDD aficionado who’d like to advocate for expanded use of TDD in your workplace, then share your enthusiasm and influence with co-workers and decision-makers.

Don’t be surprised if management tells you they can’t afford the loss in revenue or velocity that comes with greater expenditure of time associated with the learning curve. Here’s your retort: Incorporating TDD as a matter of course will save time debugging the application down the road.

Tom Barker is a software engineer and senior manager of web development at Comcast who also teachers web development at Philadelphia University. He’s co-author of Foundation Website Creation with HTML5, CSS3 and JavaScript (Apress, 2012) and author of soon to be released JavaScript Performance: Monitoring and Visualization (Apress, 2012)).


About the Author

James has a passion for how technologies influence business and has several Mobile World Congress events under his belt. James has interviewed a variety of leading figures in his career, from former Mafia boss Michael Franzese, to Steve Wozniak, and Jean Michel Jarre. James can be found tweeting at @James_T_Bourne.

Related

17th November 2026

17th November 2026

16th November 2026

16th November 2026

Join our Community

Subscribe now to get all our premium content and latest tech news delivered straight to your inbox

Popular

20319 view(s)
13529 view(s)
11765 view(s)
10344 view(s)

Subscribe

All our premium content and latest tech news delivered straight to your inbox

This field is for validation purposes and should be left unchanged.