I suppose all programmers have code that they have carried with them for a long time. I have a bit of code that I have been developing for decades, from nearly the first programs I wrote.
I don’t remember where I got the idea to make this kind of library, but I remember when things started to look like the current version. I ordered a program called OpenDoors from a programmer named Brian Pirie in Canada. I hope that’s his name…this was a long time ago. To wit, the purpose of OpenDoors was to abstract the modem/BBS interface so you could write software to work with old school bulletin boards. Definitely pre-everyone-has-it Internet.
Anyway, to work with OpenDoors I couldn’t really have much debugging output on screen, since I had it filled up with all of my awesome ASCII art. So I took some code that I had been using while learning Pascal and C that wrote printf-formatted text to files for debugging and adapted it to OpenDoors. Now I had code that would write to a file given print statements with a macro called dpr(), and it would even transmit that over the modem! An even nicer touch I had was that this macro was only a print statement if I had a #define DEBUG in the file it appeared in. Otherwise, it was a C-style line comment. This meant that I could completely remove the printing from the runtime version of the code by taking out #define DEBUG in whatever files I wanted.
Over the years, this facility evolved, mostly in my professional applications in my old job. I added capitalized versions that would print regardless of the #defines around, versions that would print out the line number, file, and time, and a version that had logging levels (plus bunches of other neat features). The log levels were nice to have too; you could take out the printing at only the cost of an if comparison to the current log level.
But all of these previous versions started as Pascal, then evolved to C, and eventually evolved to use C++. I spent a lot of today making a Java version. Unfortunately Java doesn’t really have conditional compiling as far as I can tell, but I want to find a way to easily take the printing out (I have some ideas). I always thought of that as the nicest feature of the fdebug library. For Java I think I will have to be satisfied with log levels.
I went ahead and named the package project Logbook, but I didn’t really want to. I always wanted to keep the name of the library fdebug (that’s file debugger, btw) but for various reasons we changed it to logbook later. What a boring name…no abbreviations or hidden meanings or anything.
Java has a lot of conventions about capitalization/camel case, and I thought Fdebug looked silly. So Logbook it is. Oh, fdebug, we hardly knew ye.
I should mention that I basically recreated Logbook from scratch in Java in about 2 hours. I was a little ashamed, or scared maybe? Eclipse can write a lot of code for you, which seems to work a lot better than the last time I did anything significant with Eclipse. It is really awesome to have the compiler warn you that you forgot to handle a particular exception, but to make the Twinkie completely fried in luscious batter the editor will let you surround the offending area with a try/catch in one action. That’s neat, and it works better than something like Visual Assist X. That’s a great program, but C++ keeps it from doing the awesome things that Eclipse can do when you are using it for Java.
Completely off topic: I have never loaded up a game that is so playable, and yet so rife with bugs as Dead Island. Generally when a game has this many problems there are intrinsic flaws in the design that make it all around a stinky affair. But Dead Island is fun, and it is double, triple, or quadruple fun in multiplayer. If you can get the program working…and then if it is working, there are lots of little weirdnesses and problems that can be frustrating. I am glad people have kept with it, because the game is a really cool thing and the more people keep playing it the more fixes the developers will upload. I just hope that the rage out there keeps simmering until they can fix the game. But there are too many good things coming out in the next few months for me to keep my hope alive.