When Barbara Schwarz's Toyota unexpectedly accelerated ten years ago, resulting in an accident that sadly took her life, no one would have imagined the event was triggered by a single line of text. Experts later identified that the reason for the American's loss of life was a "spaghetti-like" engine control application that no longer was in control of its creators.
Usually, awful code won't kill people, but it does make our lives more complicated. It's like a cyberattack against ourselves, which trolls people and business processes. It's work-time lost in a black hole, huge expenses, kinked nerves, and a ruined user experience. Beautiful code, however, can make a person's life better, be economically useful, and is certainly safer than bad code.
For several years now Proekspert has presented the award for beautiful code at Robotex. We're on the lookout for code that is as readable as a good short story; not too many words or rows and where every function serves a purpose. We look for code which is understandable not only to a machine but to the people who must develop that code in the future.
A few examples:
Beautiful code does not contain layers of history, knee-deep in which someday someone will discover Viking ship relics. The joy of discovery is nice, but when we don't know the hidden historical legacy, we don't know until the end, what the code does and what is needed to fix it.
Beautiful code contains commentary but not too much, because if you have to comment on your own work it means the code is too complicated. Beautiful code is difficult to build by copy-paste because this bulldozer method does not account for nuance, upon which a lot can depend. In addition, when you are copying you are in danger of duplicating errors.
Each year Proekspert presents the beautiful code award at Robotex. The winner receives €1,000. To enter the competition, send us a link to your beautiful code on this page, or demonstrate your robot code on Sunday 1st December from 10:00 to 16:30 to the Beautiful Code judges at Proekspert's booth.