Monday, July 4, 2011

Spurious environments give spurious results

I've said before, and will say it again: the suitability of a programming environment (or platform, or language, or technology stack) to a task is inversely proportional to the number of coercive statements you have to use it to get it to behave the way that is intended.

Put another way, if you find yourself trying to trick your computer to get it to do what you want it to do, you probably aren't working with the right mix of technologies.


That said, most programmers must give in to that dark impulse on a daily basis, creating elaborate fictions as it were, because the mix of technologies they must tolerate is often very unsuitable. Sometimes it seems as if the entire profession is working at the level of medieval barbers, just hacking at bits and hoping their patients don't die before paying the bills. 


A similar heuristic is that an operating environment will be as predictable (unpredictable) as it is closed (open). Or, stable environments give stable results, and spurious environments give spurious results.  You're likely to see this in Web programming when developers fail to grasp the idea of closure, and do not ensure that deployments are provisioned in precisely the same way as development and test environments.

For instance, the difference in a database from version 5.93 to 5.94 is not likely to be very great, but most of the likelyhood of failure arises from the fact that there is a difference, not the particular version numbers used.

I keep running into this issue with a Rails project, because "rake," one of the most central tools in the tool chain, is being treated as a shared component. Rake gets updated from 0.8.7 to version 0.9.2 by the bundler at some point, and things start to break.  Fortunately, bundler complains:


You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

The "bundle exec" thing is a little misleading perhaps, but at least it is actually telling the truth. The punt for now is to gem uninstall rake and remove the 0.9.2 version. The honest solution is to make sure each project gets to see only its own version of rake. 







Post a Comment