I’ve been reviewing some of my old codes that I wrote about two years ago. Partly for fun, partly because I wanted to take a look at writing the MTA I’ve been thinking about for the last couple of years. Like creative writers, or any creative works, I guess, you always have a nagging feeling that your work is never done. You just run out of time. Well, the thing about personal project is, you never run out of time.
Looking at the code, I can only come to one conclusion: It’s utterly crap. Sure, it’s well formatted and it’s tested (somewhat), but below the surface is really bad spaghetti code. It’s interesting for the little reason that I had written that code four years of professional work. I thought I was better at the time. Granted, I think I have grown as a coder, but I didn’t realize that much.
I just went through C++ version of the cdb code, and all the stuff I hate in code is there. Multiple levels of for-if-loops statements. Unclear code paths. And most importantly, mixing multiple classes in the same file.
Maybe it’s the Java developer in me speaking now, but the idea of one class pr file was a really brilliant idea (OK, admittedly it’s not really one class pr file per se since you have inner classes in Java). Given a public class, you know exactly where the definition of that class is. Not a given in C++. And I’m not really unit testing. I’m system testing the code, and not even covering all the code paths. The code is hard to read because I’m mixing comments and code, with callee functions all over the place. No real story, or clear path through the code. Looking at the code, it feels like it’s written by a recent graduate from college…
Horrible, just horrible…
It was interesting to see how far I’ve gotten in the last two years. It’s going to be interesting to see where I’m going in the next two (especially if I ever get around to learning Scala or any of the other functional languages)