Today on twitter I noticed that @OdeToCode (K. Scott Allen) this tweet.

A Refactoring Experiment

This leads to his blogpost about the experiment.

Where you will find a link to the github page where the code can be found. And you will also found how to go about it.

Here is the bad news: the new developer you hired has written some terrible, atrocious code.

No one can understand what it does.

The good news: at least there are unit tests to prove the code is working.

You job is to refactor the code and make it readable, while keeping the code in working order (pass all tests).

It’s a very interesting experiment. And I guess it tries to prove that tests can really help you refactor. And even make unreadable code readable.

Can you do it?