Inside SWT

Saturday, July 08, 2006

Code == crap

Back in university, there were two kinds of students. For arguments sake, let's call them the cleans and the scruffs. The cleans were smart guys, interested in algorithms, computability and understanding that work could be done. The scruffs were smart too. They studied and understood the same sorts of things, but in the end, they just got in there and made things go. I'm a scruff.

As a scruff, I've come to the conclusion that code is crap. I hate code. Any code. Mine too. Code is slow. Code has bugs. Given two solutions to a problem, I'll pick the one with the fewest number of lines.

As a community in the broadest sense of the word (Microsoft included), we design these monstrous layered architectures, then wonder why our systems are slow. Want to know how to make something faster? Run less code. Do you care how a library is implemented? You shouldn't. Want me to write a bunch of code in the name of truth and beauty? I won't.

Ok, I'm a closet clean but don't tell anyone ... I like binary search.

Steve

3 Comments:

  • rofl, *golf clap*

    By Blogger Chris Aniszczyk (zx), at 7:57 PM  

  • Good post :-) QNX manages to get an entire OS and internet browser on a floppy disk (not that anything can read those any more) and BeOS is blazing on the right layout.

    But it's not just less code = more speed; there's also optimisations (which may result in *more* code) that result in code being faster. The BeFS is a case in point, where there were optimsations to condense duplicate file-name entries that added significantly more code but which used a much better proportion of disk (and therefore less disk reads to get there)

    http://www.nobius.org/~dbg/practical-file-system-design.pdf

    But I agree ... less code = faster.

    By Blogger AlBlue, at 2:15 AM  

  • I agree. Sometimes a really good algorithm is very complicated and results in more lines of code. If you think about it though, the final result is less lines of assembler, when layed out end to end, with all the loops unrolled. Strictly speaking, less code is running.

    Less code has other advantages. You can understand it, delete it, rewrite it, optimize it, fix it.

    It just takes too long to understand a wad.

    Steve

    By Blogger Steve, at 12:39 PM  

Post a Comment

<< Home