Writing software for the cloud can be very different than writing software that runs on a single server. It can make test-driven development (TDD) more complicated, but it is still well worth doing. For the purposes of this article, I’ll consider two types of software development in the cloud: cloud hosting and distributed computing.
In cloud hosting, you are still writing the same type of software that you have always written. A simple example is a website developed in PHP, Java, Ruby on Rails, or .NET. You are not developing anything out of the ordinary, and the only impact cloud computing makes on your architecture is that it is easier for you to scale the web UI of your system as traffic grows.
For cloud-hosting scenarios, nothing has changed with regards to TDD. The typical xUnit frameworks will provide all that you need to write solid software using good XP practices.
Distributed computing is different. For the purposes of this article, I will define it as software that is designed to scale horizontally across many servers in order to improve some combination of reliability or speed or simply to spread the computational requirements of complex algorithms across many servers.
The use of clouds for distributed computing is more complicated and less common than the more straightforward cloud hosting scenario. However, more teams are being called on to develop these types of applications, and there are many open source projects that are making it easier to tap into the more advanced powers of cloud computing.
One example of this is Hadoop’s MapReduce project
, which is used for processing complicated jobs in parallel across many servers. Or, consider the Katta
projects that parallelize searching and indexing across a cloud. Other examples include noSQL data stores such as Cassandra
Each of these examples runs as its own server or Java virtual machine. This makes TDD a little more complicated, because you need to have those servers running and in a known state for each test that you run. Because many of these projects are relatively new, you may find it hard to find solid examples of how to do TDD with that project.
Adhering to strong test-driven practices is still very important. It may be even more important with these projects, since you will frequently change your code as you learn the nuances of the library. Having solid test coverage will make your learning experience much more pleasant, but simply writing unit tests with a standard xUnit library alone is probably not enough to test your code.