Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> comp.databases.theory -> Re: Operationalize orthogonality

Re: Operationalize orthogonality

From: Bob Badour <>
Date: Thu, 01 Jun 2006 13:52:26 GMT
Message-ID: <uiCfg.15984$>

Tony D wrote:
> Pickie wrote:

>>I ask because these seem to me to be basic concepts (or primitive types?)
>>and both of them have simple ways to represent a boolean (zero and
>>empty string respectively being false, all else true).

> I didn't comment on this sentence before, and I'm surprised nobody else
> has either.
> So far as I'm concerned, this sort of overloading of values is utterly
> shoddy. A number is a number, a string is a string and a boolean is a
> boolean. This sort of overloading is precisely the sort of nonsense
> enumerated types were invented to resolve. Say we had this sort of
> situation, in a Pascal-ish language :
> const Sunday = 0; Monday = 1; Tuesday = 2; Wednesday = 3;
> const False = 0; True = 1;
> const Red = 0; Green = 1; Blue = 2;
> var who_knows_1, who_knows_2, who_knows_3 : integer
> begin
> who_knows_1 := Green * Tuesday;
> who_knows_2 := Blue + True;
> if (who_knows_1 * who_knows_2 > (Green+Blue*Wednesday)) then
> who_knows_3 := False
> else
> who_knows_3 := True + Sunday;
> end;
> Now, what on *earth* did any of that nonsense mean ? And don't say "but
> you'd never code like that". If you overload values that way, that's
> the way you're coding all the time. And the real killer is that nothing
> in the world will ever prevent you from writing tosh like that, and
> nothing will be able to help you as and when it all goes wrong. This is
> the sort of thing type transfer functions were invented for.
> Really. The one really good thing Pascal brought us.

LOL Your post reminds me of the C++ string class a colleague I once had found online. It had constructors and caste operations into and out of every type imaginable. He thought it was the bees knees because he never had to bother with type casts etc.

Until one day he introduced a bug in his code that took days to find.

He was building a long string from a lot of smaller strings using a whole lot of statements like:

s += "Some constant text followed by a variable ";
s += sTextInVar;
s += ": " + iQuantity;
s =+ " @ " + dPrice;

s += " some more text";
s += " etc. etc.";

Of course, nobody in their right mind would create a unary plus operation for the string type. But that won't stop a determined compiler when it finds an implicit type cast to double, a unary plus operation for double, and an implicit type cast back to string:

"0 some more text etc. etc."

He fought with his code for days until I pointed out the reversed '+=', and then it took me a half hour to convince him it didn't require a bug in the compiler to treat his code as syntactically correct. Received on Thu Jun 01 2006 - 08:52:26 CDT

Original text of this message