Saturday, February 9, 2013

The Stupid, It Burns!

The netbook that serves as my primary computer is all but dead. The cats knocked it off my desk about a month ago, and it's been dying a slow death ever since. I'm not sure if the CPU heat sink has come loose or what, but after a few minutes of use, the fan runs full speed and the system freezes. I opened it up and cleaned out the heat sink that the fan blows through, but it didn't help.

In any case, I think the fan has run itself to death. I found a supplier for a replacement, but they're taking two weeks off for the Chinese Spring Festival (whatever that is) and it'll probably take another month to get the part. Maybe I'll do more surgery on it when I can get a replacement fan, but I'll probably buy a new desktop after I get paid next week.

I'm on my work laptop right now. I brought it home for the weekend to put in a few extra hours and hopefully save myself from another week as stressful as the last one. The software I've been working on is a nightmare. I can't tell you much about what it does, but I can tell you that I'd like to strangle the guy who wrote it. It violates every principle of object-oriented programming. Anyone who paid attention in an undergrad introduction to Java programming or read and absorbed Sam's Teach Yourself Java in 17.4 Seconds should be able to write better software. The only thing that makes it bearable are finding these little head-scratchers that I can laugh about with my co-workers. Here's one I found the other day:

class FooThread extends Thread {
    FooThread thread;
    public FooThread() {
        thread = this;
    // ...

The 'thread' field is never accessed again, except to conditionally set it to null.

And then there was this little gem:

foo++; // count down

Yesterday I discovered that every single one of the app's progress dialogs is a dummy. They just count up to some predetermined value (stored in a public static field, naturally) and then display another dialog that says the operation timed out. A reference to the dialog itself is also stored in a public static field so that something, somewhere, can close it if whatever process it's pretending to display the progress of succeeds. Some of the dialogs even have a cancel button that doesn't actually cancel anything except the dialog itself.

I'm glad there are libraries like Prefuse and Automaton to reassure me that working on other people's code doesn't have to be hell...

No comments:

Post a Comment