Created: 2023-04-12 22:18

Weeks of programming can save hours of planning

It is a well accepted trope/meme/sentiment in programming communities that developers are doomed to trial and error, that there’s no way to avoid the “I don’t know why it fails and I don’t know why it works”.

However great programmers seem to think differently:

  • According to Hamming, thinking before writing the code is the best way to get things right. It’s more efficient than fixing things afterwards.
  • SICP “talks” about developing an understanding of how programs behave, how programming languages execute, what are the different flows, how memory is allocated, etc. and being able to develop a mental image of how a program will behave during runtime.

By thinking properly about the code we have to write (the how’s and why’s) and by having a deep understanding of how code behaves we can greatly influence the outcome and reduce the amount of trial and error.

Type Driven Development is great here, because it forces use to think in concrete terms (the types) about our code and then be able to write code that just implements the types.