20 March 2014

Beautiful Code

That's the title of a book edited by Andy Oram & Greg Wilson. I am currently reading it.

I believe that writing good code is akin to writing good prose. The ABCs of writing prose - Accuracy, Brevity, Clarity - are applicable to writing good code.

Consider Subroto Bagchi's valedictory speech at IIMB. Observe how:

  • each episode (function?) supports a single value/moral (a function should do only one thing, and do it well?),
  • simply constructed each sentence(each line of code?) is,
  • the episodes are sequenced (sequence of function calls?),
  • all the episodes support the purpose of the talk (the deliverable functionality?).
Code - like prose - has to be engineered. Well engineered artifacts are beautiful. It takes art to create them.



No comments: