tags:

views:

105

answers:

3

I have read of the Zero One Infinity rule in software design.

Why is it called this? based on the actual behavior of software and its engineers, wouldn't this be better called the Zero One Two Billion One Hundred Forty-Seven Million Four Hundred Eighty-Three Thousand Six Hundred Forty-Eight rule, or perhaps the Zero One Four Billion Two Hundred Ninety-Four Million Nine Hundred Sixty-Seven Thousand Two Hundred Ninety-Six rule?

A: 

The point of the rule that there should be no "magic number" for the upper limit. However practically it's hard to achieve this because there'se some limitation of the implementation like width of integer and similar things. The point is when you move from N bit integer to N+K bit integer the software design should handle it naturally - you shouldn't redesign everything just because of such change. Integer representation limits should not be "magic numbers" here.

sharptooth
I agree that they _should not_ be magic numbers: the question is, why _are_ they? If Lisp decades ago could handle bignums as native numerics, what sorry excuse do we have?
Robert L
BTW, I use magic numbers myself because I just want to get the job done rather than wanting to general-case everything. In a bignum library I recently made, the base 1000 was a magic number, and just to hold myself (and others) to it, I gave the functions names like chilAdd, chilSub, etc., where "chil" is short for chiliadic.
Robert L
A: 

Because it's just guidance that suggests artificially limiting the number of instances of an entity is silly. One can easily justify ensuring that zero of a certain thing exist (i.e. yellow elephants). One can also justify having just one of a thing (i.e. one wife, or husband). However, past this limit, it becomes harder to say "Well, we'll only allow 5 Foos" - the limits are often (but not always), relatively arbitrary - someone will always want 6, or 15 etc.

Because it's just a rule of thumb, designed for humans, the upper limit of infinity is interpreted as "As many as you like". Fixing it at a given number defeats the point of the rule.

Adam Wright
Well, then why "we'll only allow 32 bits" (for an integer)?
Robert L
We don't - that's an implementation choice. Many languages/frameworks have arbitrary precision integers
Adam Wright
A: 
  1. That suggestion makes the rule name change depending on the implementation details of your product.
  2. That suggestion makes the rule name unwieldy.
  3. Isn't that suggestion a bit ridiculous?
Dominic Rodger