failing like never before

7Nov/080

Keeping It Clean

Ernest Hemingway once said, "I write one page of masterpiece to ninety one pages of shit...I try to put the shit in the wastebasket." And just like writers, programmers also manage to produce quite a bit of shit. Of course, most programmers are perfectly capable of recognizing when they've created an inelegant function, but because of time restraints and deadlines, they just keep on going. But students that are still learning to program, often have trouble recognizing when code is in desperate need of deletion.

A university-level programming class usually requires students to spend a great deal of time working on projects and homework. So its quite easy, after hours of coding, to become emotionally attached to one's code. Generally, a student programmer will make a mistake in a function or block of code, and so they'll add in a quick little fix. Eventually, after numerous little fixes, their function starts to become a giant, awkward, lumbering behemoth that is still wrong.

The most obvious choice is to simply, as Hemingway so succinctly said, "put the shit in the wastebasket" and start from the beginning. But the student has managed, after hours of labor, to become extremely attached to their hundred lines of awkward code and just can't manage to throw away the terrible result of all their hard labor. I say this because when I was learning to program, I often found myself becoming too attached to my code. On one particular occasion, I spent two days patching up the code for my self-balancing AVL binary tree, which was frankly, a piece of shit. Eventually, I threw my AVL tree class in the garbage, started again from scratch, and recreated a working tree class in a few hours.  If I had only been a little more emotionally detached, I might have realized how stupid I was acting.

In order to keep code clean and effective, student programmers need to learn to stop falling in love with their misshapen code-children; code cannot love you back, so don't waste your time developing emotions for it. Just keep it clean kids, and save the loving for another time.

4Nov/080

Making Good Time

I thought I was pretty cool, riding my bike to and forth from class. Instead of the normal fifteen to twenty minutes that it would take me to walk from my room to class, I can now bike to class in about five minutes, even less if I don't have to slow down when people cross the street. It takes a little bit longer to get to my room since its all up hill going back, but I can still make good time. The only down side is that I get pretty sweaty, especially coming back to my room. (I don't have a road bike, or even a lightweight hybrid: I've got an old chromoly Trek 820 mountain bike with 1.95 inch tires, so its a lot harder for me to reach the same speeds as a racing bike.)

The fact of the matter is, I always thought I was pretty cool, racing cars (and sometimes beating them!) to class. But I saw the most amazing thing as I was picking up my bike to head back to my room last week: a segway locked up at the bike rack. So I took a picture, for my blog.

I actually saw the guy, riding his scooter up the hill a few days ago. I was sweating up the hill and he was crusing along, cool as a cucumber, talking on his cell phone the whole time.

Tagged as: , , No Comments
4Nov/080

Election Day

Come on, all you lazy Americans! Todays the presidential elections, and as much as you hate it, its your civic duty to vote. Even I'm voting!

Tagged as: No Comments