Re: An idea for a freak DWIM lisp-2



(Warning: mathematicophilosophical maunderings ahead.
Proceed with caution.)

Kent M Pitman wrote:

[about the "0,1,infinity rule"]
>>> Yeah, and I'm sure it's probably linked to or mirrored at www.mormon.org.
>>
>> ?
>
> I was wondering if anyone was going to be confused. Since you ask, there
> are two reasons I mentioned this.
>
> First, Mormons support polygamy. Presumably they could argue, by the
> aforementioned rule, that 'infinity' is a bound that requires no
> justification and is simply an obviously elegant boundary.
>
> But second, it brings up the matter that I see is confirmed later in
> that entry, which is whether the rule "one, two, many" has as much weight.
[etc]

I don't think anyone seriously regards the 0,1,oo rule
as Holy Writ. It's a useful rule of thumb. Let me suggest
two other ways of stating more or less the same thing:

- Anywhere in your program or design where you have
a number, it's probably a bad sign if there isn't
a clear answer to all questions of the form "so why
not ___ instead?" with another number filled in.
(An answer might be clear by virtue of being already
there in the comments or design documents, or by
virtue of being obvious.)

- Anything in your design that needs *numbers* as such
is likely to be wrong; all numbers should be readily
explicable (and explained) in non-numerical terms.

Neither of these is intended to be more than a rule of
thumb either. And I hope I don't need to say explicitly
that, e.g., the second version doesn't justify using
9 as a magic number in a networking protocol because
you could replace it with "the number of planets in
our solar system" :-).

These are both special cases of a more general principle.

- Suppose there is some symmetry or near-symmetry of
the space of all programs. Then any respect in which
your program fails to be invariant under it needs
justification. (Likewise for designs.)

More tersely: symmetries should not be broken without
reason.

All numbers look somewhat alike, especially large-ish
ones, so if you use the number 1729 somewhere in your
program or design then there ought to be some reason
why it's better than 1728 or 729 or 9271. (Anyone who
thinks I'm denying that different numbers have
different properties should google for "hardy taxicab"
and reflect on my choice of example.)

Similarly, if your program has variables called a,b,c
then permuting them is a near-symmetry, so either your
program should be invariant under that permutation
(as e.g. if everything done with them is symmetrical)
or there should be a reason for the asymmetry (as
e.g. if you're using c for the speed of light).

Once again, if you try to treat this as a hard-and-fast
rule you'll likely get silly results.

Here's a complementary principle:

- Suppose your program is invariant under some symmetry.
Then that's probably a sign that you could make it
shorter and clearer by expressing the symmetry explicitly.

This is why you replace repeated code with loops and
functions and macros and so on, and why you replace
repeated variables with aggregate data structures,
and why you move common structure or functionality
up from subclasses into their common superclasses.

Do these principles contradict one another? Not when
rightly understood, because there are two different
ways in which something can be invariant. It can have
different parts that are the same, or it can have
single parts that are themselves symmetrical. It's
really the first case that's discouraged, not the
second.

This is all rather half-thought-through, but I need
to go and put some shelves up now. :-)

--
Gareth McCaughan
..sig under construc
.



Relevant Pages

  • Stillwater anorthosite/pyroxene couplets... was Re: A message from Sean Pitman
    ... |> parameters of symmetry and surface roughness which distinguish ... | materials, such as granite. ... | found on an alien planet without any knowledge of any aliens occupying ...
    (talk.origins)
  • Re: Actions, symmetries, and gauge theories
    ... Suppose that we have some theory which is invariant under the action ... Since this theory is a gauge theory, ... generate a different symmetry group in the equations of motion. ...
    (sci.physics.research)
  • Re: Seans Smooth granite block
    ... Humans also make big asymmetrical "modern-art" type granite monuments ... People, that we know about, also design very amorphous looking granite ... Because the degree of reflective symmetry, ...
    (talk.origins)
  • Re: rc functions dont allow processes to shutdown
    ... /etc/rc.d/ntpd stop won't actually shut down ntpd. ... I checked a couple of other processes(like net-snmp) and noted the same behavior. ... I'll take design issues there. ... The symmetry here would be to stop it the same way. ...
    (freebsd-hackers)
  • Re: Is symmetry a mere coincidence
    ... As for bilateral symmetry, you can arrive at it from first principles. ... For a creature on land, up is where the air is, and the sun; ... "Design" is a tricky word. ... destroy energy. ...
    (talk.origins)