In the olden days, when I was just starting my foray into the programming world (you know, late 80s, early 90s) we had this programming courses at our school. In this courses basic programming idea and knowledge was passed to us from old guys (you know in their 40s) with glasses and white lab coats. We also did a lot of programming, but there was a little twist. Each and every programming task had to be done on paper first.

The purpose of this was not to spare on punch cards (they were cheap in those days and thankfully obsolete), but to learn to optimize code. You see, in those days, code optimization was not a side thought like it is these days. A poorly written program was destined to run out of memory and crash or worse, not even start. Thus, optimization was a key part of every development cycle.

But why write code on paper?

Writing a 100 line function on paper is quite a chore and when it comes to chores, we, programmers, are lazy by default. Thus, before we put something on paper, we thought hard about what we needed to do to make solution as short as possible. Also, we didn’t want to write it more than once, so we made darn sure that the code we wrote could be used multiple times and was working as well. Needless to say, this increased our knowledge and understanding of programming.

That was then. This is now.

As far as I agree that code optimization is somewhat redundant these days when compilers do powerful optimizations, hardware is cheap, easily accessible and is bound to become powerful enough to run any sort of crap you write, it would be nice, if people actually thought what they did before they did it and understood what they wrote. Writing actual code on paper might be a step too far these days, but writing pseudo code will help you:

  • understand the problem better and
  • find a simpler solution to your problem.

 

Sure, some people might claim, this is nothing more than throwing money down the drain, but those are the same people who write a piece of code with 100 calls to String.Replace C# function (or a pivot on several million rows in SQL) and then wonder why their application is “a tad slow”. Don’t get me wrong, you don’t need to over optimize, but you do still need to make your code runnable. Hence, when you encounter a non-trivial problem, grab a pen and a piece of paper and write it down.