Friday, July 16, 2010

Signs of hope

Apparently, not all was lost. Slowly I started to see signs around me that I wasn't entirely alone. There were books written on design of software, the concept of design patterns was introduced and formalized, and my university even started teaching courses in it. There seemed tope that I was on the right track. Yet once again, as soon as I talked to people in the real world, they thought concepts of proper software design were cool in principle, but too much of a bother to use in practice. There were projects to finish, research results to get, and since noone in the outside world cared how your code looked, you could get away with writing it however the hell you please, which 99% of the time meant writing it badly. Interetingly enough people whom I talked to were aware of the fact that their code was written badly, respected me for trying to do a better job, and yet didn't really take the time to improve themselves in this regard.

One day I had an eye opening experience. I was trying to get into somebody else's research code in grad school, to figure out how it worked, so I could use it. Back and forth, back and forth, I went between the classes and the functions which all seemed to be in one file. It was too much to read through on screen, so I decided to send it to the printer. I let it go, and when I came to the printer it was out of paper, even though at least 20 pages were already on the table.WTF? I went back to see how many pages were actually sent to the printer, and to my utter astonishment I found out the file was 115 pages long! No wonder I couldn't make sense of it. I gave up on trying to reuse this guy's code, and vowed to myself to never write code like this.

I noticed also that when people looked at my code, they could fairly easily understand what it was doing, but when I looked at theirs, I would typically be lost. Maybe I was onto something. Maybe the "proper" way of writing would save me in the long run? So I pressed on, partly because I hoped that in the end it would pay off, and partly, as much as I hate to admit it, because I simply couldn't stop. Refactoring just felt so good.

No comments:

Post a Comment