Complexity constant under variable renaming a modest counter-example
Weyuker proposed that the complexity
of a program is constant regardless of the names of the variables (Property
8). Actually, she acknowledges that variable names might be meaningful
when trying to assess psychological complexity. Then, she says that this
meaningfulness presumably varies with the individual programmer, and does
not consider this further. Her property 8 then states the opposite, that
variable names are not meaningful.
I see lots of room for mischief here, and give a short
example with three syntactically identical program fragments.
Consider the following program fragment:
A = B * C;
D = B * E;
F = A D;
Then consider this fragment:
GrossSale = Units * PricePerUnit;
GrossCost = Units * CostPerUnit;
GrossProfit = GrossSale
GrossProfit;
Now consider this fragment:
IOIOIOIOIOIOIO1OIOIOIOIOIO = IOIOIO1OIOIOIOIOIOIOIOIOIOIOIOIO
* IOIOIOIOIOIOIOI0IOIOIOIOIOIOIOIO;
IOIOIOIOIOIOIOIOIO1OIOIOIO = IOIOIO1OIOIOIOIOIOIOIOIOIOIOIOIO
* IOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIO;
IOIOIOIOIOIOIOIOIOIOIOIOIO = IOIOIOIOIOIOIO1OIOIOIOIOIO -
IOIOIOIOIOIOIOIOIO1OIOIOIO;
I claim that all three of these fragments perform the
same computation, and that they are renamings
of the each other. But, I think its intuitively obvious to the most casual
observer that the psychological complexity is vastly different.
|