My Struggles with TDD

If you’ve spent any amount of time being a developer, I’m sure you’ve heard of TDD, or Test-Driven Development. The point of TDD is that you write a failing test first, write the code to make the test pass, refactor the code, and then repeat. All programming languages can follow this pattern to create well-constructed code. It also allows you to do more refactoring down the road and make sure that the changes don’t break other aspects of the application.

So What’s the Problem?

I titled this post talking about my ‘struggles’ with TDD. I wouldn’t say I struggle with it because I know how to unit test my code. What I struggle with is using the concepts on a real application. I get the project requirements, I start laying out the database and creating mock-ups. It’s at that stage my developer brain says that I should start writing tests, but I am overwhelmed on where to start.

This leads me to believe my code is less valuable if there’s not some sort of underlying unit tests giving it that coveted 100% coverage. This makes me feel I’m testing more for a number, than to actually make the code more rugged and resilient to bugs.

I’m Not Alone

Recently, there was a big discussion on if TDD is dead or not that I found quite interesting. It was held in a Google Hangout, then posted on Youtube, by a few prominent heads of the programming universe: David Heinemeier Hansson, Martin Fowler, and Kent Beck. It was started by David posing the question, is TDD dead? He listed the reasons why he feels that test-first does not guarantee clean code.

I don’t think David was totally advocating to not do TDD, but moving to doing more system level tests. Those I can grasp because they can more align with how a user would use it. Yes, classes are not in isolation, but at least you can see that the system is functioning correctly.

Thoughts?

I wanted to quickly share this dilemma of mine to see if there’s other developers out there that share that same sentiment. TDD is easy to understand how to do it, but doing it on a real project is a whole different story that isn’t as easy to grasp.

Share your thoughts in the comments below or hit me up on Twitter.

Beginner Node.js – Part 2: Node.js Basics

This is the second post in my beginner Node.js series. If you missed part 1, make sure to go back and check it out as this will continue to build on that.

In Part 1, I briefly explained what Node.js is and showed how to get it installed on the 3 major operating systems, Windows, OSX, and Ubuntu. In Part 2, I want to focus more on what Node.js is and what concepts one would need to understand in order to develop effectively using Node.js. Although it is just JavaScript, there are some additional concepts that make JavaScript effective on the server. Continue reading

Angular.js: My First Experience

After finishing up two long projects, my next endeavor was to create an app for the localAngular.js airport. They were looking for an app that was fast, small, and would update in real time. Doing a lot of reading on Angular.js recently, I figured it would be a good fit for this project due to the small nature of the app. After doing a few months of development, I wanted to share some of the awesome, and not so awesome, things I ran into while using Angular for this project. Continue reading

Beginner Node.js – Part 1: Install

Beginner Node.js

This is the first in a multi-part series I’ve been wanting to do on beginner Node.js. JavaScript was a language I found interesting. The concepts of callbacks, functions having methods and properties, and a native data store in JSON, were things that set it apart from other languages. There’s been lots of buzz on not just Node.js, but JavaScript as a whole. I’m sure you’ve seen the numerous new JavaScript frameworks and libraries popping up all over the web. Before we start, during this series I’m going to assume you have some knowledge of the JavaScript language. You don’t need to be an expert, but a working familiarity will definitely help. If you haven’t touched JavaScript before, this article from Codetuts outlines a good way to learn the language. Let’s begin. Continue reading