Krista's Coding Corner

30.09.2012

Value or name?

High level programming languages are nice because it is fast to do even quite complicated things. But sometimes they can create quite a mess.

Because we have these ‘high level’ dictionaries or objects, there can be difficulties to see what is actually happening and what sort of automation is really going on. One of these problems is expressed nicely in this quote related to Niklaus Wirth:

"Whereas Europeans generally pronounce his name the right way ('Nick-louse Veert'), Americans invariably mangle it into 'Nickel's Worth.' This is to say that Europeans call him by name, but Americans call him by value." — Niklaus Wirth's introduction by Adriaan van Wijngaarden at the IFIP Congress (1965).

At first this may not sound so big deal but if we take a closer look to the problem, the awful truth reveals itself.

Let’s imagine that we collect to a table values from a certain formula with changing variable value. Like we add 3 hours to a current time (x = current_time + 3hours). If we save the values of the formula by value (== what the result is, like 10:33), everything goes like we expect and wanted. If we save these values by name (== result is variable x), then every row in the table has exactly the same value in the end.

The difference is:

If your tables are doing something weird, consider this problem :) It may show itself if the coder doesn’t see the difference between value and name (+ memory pointer) OR if we are using these high level languages that hide what they are actually doing.

blog comments powered by Disqus