A note: Because this entry has a mixture of sarcasm and genuine-feelings-that-could-be-interpreted-as-sarcasm, I've denoted sarcastic comments in bold and italics.

And because this is a technical post:


Rachel McAdams - what happened to her?

. . .

Was reading some SimpleDB docs, and ran into this paragraph:

It is important to remember that Amazon SimpleDB is a schema-less datastore and everything is stored as a UTF-8 string value. This provides application designers with the flexibility of not predefining different data types for their attributes, but rather changing them dynamically, as the application requires. (ed. note: snipped example) Amazon SimpleDB provides the flexibility of storing all data in one format, allowing developers to make data type decisions in the application layer without the data store enforcing constraints. As a result, all predicate comparisons are lexicographical in nature. Therefore, when designing an application, you should carefully think through storing data in its appropriate string representation.

Technical arguments about SimpleDB's merits aside, the notion that the data store isn't magical is incredibly refreshing to hear. If you're going to layer stuff in abstractions, you better make sure the abstractions are dumb, and stupid magic (for example: magically converting tinyint(1) into booleans) isn't happening. Nothing frustrates me more than one part of the stack magically transforming shit that shouldn't be transformed.

(Although in defense of Reggie Burnett for allowing such heinous logic to be checked into the mysql connector, mySQL's own documentation states: )

BOOL, BOOLEAN

These types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.

So they intentionally overloaded tinyint(1) with BOOL or BOOLEAN. Nice. Oh, and the nice little note:

We intend to implement full boolean type handling, in accordance with standard SQL, in a future MySQL release.

Nice ... so in the absence of real support, they change how one feature behaves. Magic! This could never cause problems! It certainly is too hard to expect developers to convert ints to bools in their own applications! Everybody knows that since tinyint(3) displays up to 3 digits, tinyint(2) displays 2 digits ... that tinyint(1) would display a boolean! Yes! Perfect sense!

So I guess my amazement at Simone and Reggie in the past post was a bit misplaced.

. . .

I'm especially frustrated today because one of our Deki Wiki developers messed with the PHP bootstrapping code, which basically caused the application to end up in an endless loop in the case that the API wasn't accessible. In pseudocode, here was the "magic":

index.php:
if (!try_to_access_api()) { redirect('index.php'); }

The problem being, every time the API failed, it would reload the page, which would ... then fail to load the API. Bulletproof logic! Nothing could possibly go wrong!

The problem with abstractions on the front-end is that you always be writing special cases for user interfaces. If you're an abstraction astronaut, all the special cases are going to increase the probability of leaky abstractions, which causes the whole thing to come crashing down to the ground.

Posted by roy on February 7, 2008 at 04:23 PM in Web Development | Add a comment

Related Entries

Want to comment with Tabulas?. Please login.