APR 11, 2017
Written by Tiffany Gill

Hello, TDD!

Have you ever had one of those “down-the-rabbit-hole” experiences, in which one idea sends you careening through a wormhole of thought? Such a journey often yields unexpected results, yet the “mind map” of your travels can actually be even more surprising. Well, it was one such “Eureka!” moment that convinced me of the parallels between the classic Hello, World! program and Test-Driven Development (TDD).

The Confidence Question

It all began one evening over a couple of beers, when my network engineering friend shared his apprehension about coding. He is transitioning to DevOps and asked me how I gained confidence in my coding. I compulsively rattled off a list of foundational knowledge that any developer should know, such as design patterns and best practices (for more on the essentials, check out Nickie’s insightful article). I could not, however, fully articulate exactly what gives me “coding confidence.” It would be days later, while working with RSpec code, that I would discover my true answer to his question.

The Parallel Principles

For the last two months, Ruby, RSpec and TDD have overwhelmed me with a wave of nostalgia that harkened back to my days as an enthusiastic computer science student. Initially, I didn’t understand the connection. Then, I recalled the conversation with my friend. I can attest that I experienced unequivocal assurance in my programming from the very first time that I saw Hello, World! flash in my console window, nearly twenty years ago. And now, I was experiencing that very same feeling as I watched successful RSpec test results display on my screen.

It occurred to me that I haven’t felt such excitement and accomplishment since school. Most of my programming career has been spent in machine-like work environments that operate much like a hurry-up no-huddle offense in American football, rushing plays and suffocating flexibility. I’ve been part of software teams in which we were expected to write code as quickly as possible and, then, to spend most of our time “pushing out” new features on top of and fixing bugs within that poorly-structured architecture. Sometimes, spiraling a Hail Mary deliverable was required just to make a short deadline, and you could only pray that it worked as expected.

This type of environment did not value testing frameworks nor nurturing a developer’s confidence.

But my student days did:

When most of us begin to learn a new language, the first program we write is Hello, World! Whether consciously or not, through Hello, World!, we are exposed to the basic principles of TDD.

The Hello, World! program introduces you, inadvertently, to your first test, a “sanity check” of sorts. First, the program confirms that the new language has been correctly installed. Then, it verifies that the developer understands how to use it. Programming an application is a lot like building with Legos. To build hearty, scalable code, you must ensure the viability not only of the whole structure, but also of each distinct block. TDD empowers developers to instantiate customized testing for both the integrity of each part and the integration amongst parts, throughout the construction process.

Kent Beck, the revolutionary software engineer, hails that “Test-Driven Development is a set of techniques any programmer can follow, that encourage simple designs and test suites that inspire confidence.” In essence, TDD is a “coder’s compass,” offering constant feedback from the system.

The Communication Factor

One of Corgibytes’ core values asserts that, “Communication is Just as Important as Code.” Indeed, communication is a variable so indicative of the final result of any project that we quite rightly reflect upon it in multiple contexts, including amongst team members and with clients. However, lest we forget that programming is, in fact, a form of vital and interactive communication between developer and system. In effect, Test-Driven Development is a conversation, between coder and machine, translated across many languages. This communication produces a certain level of trust and confidence in the resulting application.

The Hello, World! Impact

Over the years, I have largely forgotten the impact of my first Hello, World! program. In the traditional corporate scene, I had become conditioned to tuck it away into the recesses of my imagination and relegate myself to a factory-floor style of programming. And now, thanks to a simple question from a dear friend looking for advice, it has now resurged clearly as the key to my confidence in my coding.