Monday, July 10. 2006Good variable namesIf you're like me, then you might have a negative reaction when encountering Java™ code like this:
private int zero = 0; You might think that naming a variable for it's value rather than it's purpose is a mistake. You might consider calling it initialCoffeeCount rather than zero.You might also think that it should be made final so that you can't accidentally change the value. Obviously, something called zero must only contain the value 0, right? What then, do you think when you find this farther down in the code? zero = 1; Trackbacks
Trackback specific URI for this entry No Trackbacks
Comments
Display comments as (Linear | Threaded)
Maybe zero is an acronym for something else in the author's domain? Perhaps it stands for "Zardoz Eternals Remaining Option" in a shoot-out game inspired by Boorman's cult classic... ;o)
Assuming that the author really meant what you quoted, it really takes some inventive mathematics to set zero to 1. Quite darig, I should say. It's a bit like jumping from the Euclidean space into hyperbolic space. Thanks for the cheerful example for this rainy Monday! Add Comment
|