Trying Test-Driven Development
11/09/15
So, you may have noticed I mentioned a lot of JavaScript test frameworks in yesterday's post, Stephan.
Last week at work was one of the best weeks at work I have had. There's a lot of unpacking to do to really discern why it was the best, but one of the reasons was trying out making tests before implementing functionality.
This.
Felt.
Amazing.
So amazing that I want to replicate it at home.
The problem?
I have written literally zero tests at home, and zero tests in JavaScript ever.
And that was a problem I was addressing last weekend. And I'll cover that in another post.
But I want to talk about why I like test-driven development so much.
I have always had trouble feeling productive in the working environment. It just feels I move slowly, and I don't make up for it with quality. Years ago, when communicating this with my friend, he made an excellent observation. The way I play games is that I tackle the given, well-defined and well-designed problem, and try to rush through it until I'm good enough at the game such that I can survive until the next proper check point.
I like to improv speedrun games.
"So, why don't you just speedrun work?" he asked me.
This question has stuck with me for a long time, and I've tried various things to achieve exactly this. One such thing was AgileGame. That was getting close, but something was missing. It was missing a proper immediate, external feedback system.
Test-driven development allows me to speedrun work. Each test is a level I must beat, and it posits no qualifications on the quality of that initial solution. When there is no test, I have the clear goal of a test that properly checks for whatever I'm trying to implement, and with the test, I have the clear goal of passing the test.
After both test and implementation are there, I then have the more ambiguious but personally enjoyable goal of cleaning up the code. This is like exploring a level I beat for neat secrets and tricks. The level still needs to be beaten, but I have creative control now that I have already proven that I can beat the level.
Test-driven development meshes with my brain in just the right way to allow me to work effectively.
So, with my limited experience working this way, I'm diving in and seeing how far the philosophy can take me.