Sunday, July 25, 2010

Programming assumptions

A database specialist and blogger I follow came across this post:

which got me wondering, what assumptions have I made that turned out to be incorrect?  The one that came to mind for me was the idea that going to the database is slower than pulling in all the data you need at once and querying the stored data when necessary.  It really depends on your situation.  When you don't have to deal with remoting or firewalls, it is very often faster to query the database than to use a stored list.

More importantly, though, this question should make everyone ask themselves: what assumptions do I make today that are based on incomplete, out-dated, or inaccurate information?  A post like this one is good in that it helps everyone to see what assumptions had been proved false and allows all the posters and readers to learn from others' mistakes.  However, the goal should be to question our current assumptions, not just take pride in previous lessons learned.  Looking back is certainly a valuable exercise, but looking for new lessons to be learned is more important.


  1. Good link Scott. At some point we all make an assumption that turns out to be false. Do you think that requiring designers to justify their design would cause these false assumptions to rise to the surface faster?

    Take the assumption about the random order of execution of logical operators as an example. This assumption could necessitate some pretty extravagant case handling that wasn't actually necessary. If the coder was asked why they had designed the function that way, the assumption might become clear.

    Granted, assumptions aren't always as evident, and drilling down to the true assumption may take a huge amount of effort. Perhaps this is why the practice isn't commonplace.

  2. I think being able to justify any decision will help alleviate false assumptions. However, it's all too easy to come up with some incomplete or inappropriate "explanation" as a justification. As an individual, it's important to be honest with oneself. As a manager, it's important to make sure your reports keep an open mind.

    I agree with your comment about this being time-consuming. There's definitely a time for reflection and a time for getting it done. Most people I encounter spend their efforts on the latter and neglect the former, though, hence the blog post.