At work we started watching “Clean Code” by Robert C. Martin (“Uncle Bob”) a couple of weeks ago. While some colleagues are of the opinion that these videos are unbearably stupid (and they do have a point: the way all the knowledge is presented is… uhm… questionable, at least) I have grown quite fond of some of the things Uncle Bob has shown us.
Two points that have especially struck home for me: keeping methods short and test-driven development. While the former is (more or less) easy to implement the latter requires more discipline and is also difficult to work with when a sufficiently large codebase already exists.
So lately I have been writing tests. Thousands and thousands of lines of test code have been added to Sone; in the process I was able to eliminate almost the same amount of lines from the production code because it proved to be unnecessary after various refactorings have performed.
However, one of the targets of the current refactoring still has not been achieved: storing everything in a database. I am a lot closer to finishing this task, though: most objects and their relationships are already managed by a non-persisted, in-memory database. Persisting the database will be a second step that follows later.
I will continue writing tests and increasing coverage to make it easier to finish the big refactoring. Unfortunately that will mean that there won’t be a new Sone version in the near future.