Should You Use TDD on Freelance Projects? Comparing Quality vs Speed

0
272

When approaching a new freelance project, one of the first questions many developers and designers ask is:

Do you want it done fast… or properly?

In this guide I’m going to specifically discuss the topic of whether or not you should use TDD on freelance projects. However the concepts I’ll discuss today apply to any type of quality control system.

Quality vs Speed

tdd on freelance projects

There’s an old software engineering rule that states that there are three options you have when building a project:

  1. Quality
  2. Speed
  3. Cost

This diagram represents this rule as a venn diagram. The elusive center is where you have a project that’s built quickly, for a low price, and was created with industry wide best practices.

In my experience it’s rare for a project to reside inside of this sweet spot. Instead I’ll tell clients that they can pick two out of the three. For example:

  • You can have the project built properly for a low cost, however it’s going to take quite a while to develop. This is because the project will need to sit on the back burner since higher paying projects will need to take precedence.
  • Alternatively the project can be built quickly at a low cost. However this approach won’t allow for the time needed to follow best practices, such as building automated tests into the application. I rarely offer this option to clients because it’s too tempting for them and I’ve seen from experience that these projects always end badly.

TDD on Freelance Projects

In this guide I selected the concept of test driven development (TDD) as a measurement of project quality for one key reason. Every time that I’ve been handed a messy legacy project to work on, there is always one common characteristic that they share:

The code doesn’t have a comprehensive test suite.

On the other hand, whenever I start working on a quality application I’ve discovered that these projects pretty much always have solid test coverage.

So I’m not saying that a full test suite is required for a project to be considered a quality product. However in my experience tests seem to be a key indicator that determines how well an application was built.

Making the Decision

So when you are embarking on a new project how should you decide on whether or not to use TDD?

Giving No Choice

I know plenty of developers who simply do not give clients a choice in the matter. All code that they write will be tested, period and full stop. This helps make the decision process more straightforward. This is the approach I take now, but that’s only because I now have the ability to be more picky when it comes to the clients I take on.

However if you are new to freelancing and you need clients it can be difficult to tell a client that a project will be around double the time and cost. If you don’t have a strong set of preexisting you may find yourself in a situation where you price yourself out of the market.

Letting the Client Decide

Alternatively you can let the the client decide on what approach they want you to take. In this situation you propose the pros and cons to building a full test suite compared with only building the application itself. If you have an intelligent client they will most likely see the benefits of including tests and choose for the pricier option.

This is an effective strategy because it allows for you to bring the client into the decision making process, which will make them feel involved in the work. And if the client is still looking at other freelancers, this approach may help win him over.

Another benefit to letting the client decide is that his response may give you insight into how he thinks. If he acts like tests are a pointless luxury and says that he simply cares about getting the project complete… He might be a nightmare client. And in cases like that you are better off moving onto more informed people to work for.

Using Common Sense

Lastly, make sure that you’re using common sense. Imagine being asked to build out a simple corporate website. In cases like this you only need to write some basic tests. At the most this should only add an hour or so to the project. There is no need to bog down the process writing tests that verify that every CSS class and ID are shown on the page.

As with most concept in freelancing and life, common sense is one of your greatest tools.

LEAVE A REPLY

Please enter your comment!
Please enter your name here