Your code is not "Beautiful"


I have a pet pieve. Actu­al­ly, I have many, but only a few worth com­plain­ing about. One of these is when pro­gram­mers describe their cre­ations as “beau­ti­ful.” At first blush it might seem strange that peo­ple would describe com­puter code, filled with semi-colons, parentheses, and brackets as “beau­ti­ful.” One might be tempted to ask whether they were just in love with their syn­tax high­lighters. How­ev­er, I’ll be fair. The term “beau­ti­ful” in this sense refers not to visual aes­thet­ics, but to a sort of notional aesthetic: ideas which seem so sim­ple and ele­gent that they pro­vide a cer­tain sense of plea­sure when one comes to under­stand them. When coders use beau­ti­ful as an adjec­tive to describe their pro­grams, they aren’t describ­ing the visual asthet­ics of their com­puter code, they are dis­cussing the pre­summed ele­gence of their solu­tions. They are declaim­ing the clev­er­ness of their own inventions.

And at this point one should real­ize my first and more shal­low objection: That prais­ing your own work is just a lit­tle bit pre­sump­tu­ous. If some­one were to approach you and inform you that the paint­ings of some unknown painter were beau­ti­ful you would likely take the per­son’s words as sim­ple praise, but if the painter him­self were to approach you and make the same claim you’d likely think that he was a lit­tle full of him­self.

The prob­lem here is that when a cre­ator praises his own work it’s hard to dis­tin­quish between gen­uine enthu­si­asm for the work itself and sim­ple ego­ism. Cre­ators put a lot of effort into their cre­ations and often have dif­fi­cult and com­plex rela­tion­ship with them, so it’s under­stand­able that their ego would get wrapped up in their cre­ations, but that still col­ors how one views a cre­ator’s words. The fact is that, “beau­ty” is inher­ently sub­jec­tive and when peo­ple make sub­jec­tive judge­ments, who makes the judge­ment mat­ters as much as or more than what that judge­ment is. So when a pro­gram­mer calls his own code beau­ti­ful, it’s hard to take him seri­ous­ly.

And that leads into my sec­ond and, in my opin­ion, more impor­tant objection: That plac­ing empha­sis on a purely sub­jec­tive judge­ment dis­tracts from more impor­tant mea­sures of code. There is a place for self praise or brag­ging amongst pro­gram­mers. In order for them to be use­ful, peo­ple do need to get the word out about their works. How­ever praise should be use­ful.

Call­ing a pro­gram “fast” is use­ful. Speed may be rel­a­tive, but it is some­thing we can mea­sure and it’s worth is under­stood. Like­wise, terms like “cor­rec­t,” “sim­ple,” and “portable” are all also use­ful. Some may be more dif­fi­cult to mea­sure, but they all denote a clear qual­ity of the code which is use­ful for judg­ing it. “Beau­ti­ful” how­ev­er, denotes noth­ing speci­fic. It may denote the sim­plic­ity of a solu­tion, or its clev­er­ness. It may refer just how well suited a solu­tion is to a spe­cific prob­lem, or how gen­eral it is. Real­ly, it means what­ever one wants it to mean because aes­thet­ics are inher­ently sub­jec­tive. It may be legit­i­mate to call a piece of code beau­ti­ful, but it can be beau­ti­ful for a num­ber of entirely dif­fer­ent rea­sons, and unless you spec­i­fy, it’s just not a very mean­ing­ful thing to say about a pro­gram. That’s all.

    Last update: 01/12/2011

    blog comments powered by Disqus