August 25, 2007

Blog has been moved

This post has been moved to blogspot. No further posts will be made to this location.

My notes on "What makes code beautiful?"

I'm blogging some notes here so that I can remember some key points from the 65 minute presentation What makes code beautiful? (via Hey! Heads Up)

"You should write code like the person maintaining your code is a homicidal maniac and knows where you live."

PIC: Proportion, Integrity, and Clarity is the theme of what makes code beautiful.

Negative laws are easier to follow, eg. "don't kill", "don't steal", etc. These allow anything else to be allowed, which provides more freedom since the original authors can't think of everything. Along those lines, it might be a lot easier to follow the maxim "don't write ugly code" rather than "write beautiful code".

In the end, it's just KISS.

Posted by jim at August 25, 2007 11:24 AM
Comments

The homicidal maniac comment was interesting -- I took it to refer to open source code, where anyone can read what you write and it's constantly criticized. This positive is that code authors are more mindful of not writing ugly code (and improving clarity) -- the negative is that some people don't like the constant criticism that public code generates. It's just the nature of the beast I guess.

http://www.heyheadsup.com/item/211-screencast_of_what_makes_code_beautiful_by_marcel_molina_jr_

Posted by: Ryan at August 25, 2007 09:17 PM

That's funny that you took it to referring to open source because I assumed that he was talking about closed source!

With open source I would think that it's always in your mind that someone will be looking at your code. The shame factor is pretty high if you write crap.

With closed source it could be *years* before someone would have to go into that module and modify it or fix a bug. You could be long gone from that job, so why not write crappy code now? That's where it's good to keep an idea of someone tracking you down and make you "pay" for the crap you caused.

Posted by: Jim at August 26, 2007 09:46 AM

The guys at this conference write open source code, so I took it that way. :)

It could be years, sure. I dunno about you, but it doesn't take long for me to forget my assumptions about a specific piece of code. More likely it'll end up being yourself staring at this code trying to figure it out. The homicidal maniac will be you, ready to kill yourself for causing you future headaches. :D

That's enough motivation for me to write clear code, especially since I refactor so much.

Posted by: Ryan at August 26, 2007 09:45 PM

I like using pretty fonts.

Posted by: Aleks at August 28, 2007 10:45 PM
Due to the proliferation of comment spam, I’ve had to close comments on this entry. If you would like to leave comment, please use one of my recent entries. Thank you and sorry for any inconvience caused.