I was just considering that perhaps the Infinite monkey theroem should instead be the Infinite Doozer theorem. Not only would this allow one to conjure a much more humorous mental image, the Doozers are obviously much more industrious than monkeys and therefore much more suited to toiling away in front of typewriters. There is also the fact that an infinite number of Doozers with an infinite number of Doozer-sized typewriters would take up far less physical space than an infinite number of monkeys.
ORM: Metadata mapping
Using Metadata – Martin Fowler
The most time spent working on a site under exhibition was the model or database layer. So before really getting into the rewrite I wanted to see what else was out there that could simplify this. Obviously I was turned to Fowler’s Patterns of Enterprise Application Architecture and ActiveRecord (rails), Hibernate (java) etc. One common element with every ORM solution I have run across is that they partially violate the DRY principle. Those that don’t, or that give you the option of completely defining your schema in a format native to the ORM are not expressive enough to use the full power offered by the database. This is when I remembered that PostgreSQL implements an extension to the SQL standard information schema that allows you to add an arbitrary comment to nearly any database object, tables and columns inclusive. After some poking around I found that MySQL supports the same, although it is not nearly as well documented. SQLite does not share this non-standard extension. So, my thought at current is to express whether relations are one-to-one, many-to-one or many-to-many directly in my table declarations. The only drawback I can see is a lack of portability, but when it comes to PHP, how many people use anything other than PostgreSQL or MySQL? SQLite should be used a great deal more, in my opinion, but in practice I do not believe it is. If at some point I must be portable to something other than the common case, well, in that event I guess I can always just do what all of the ORM’s are already doing.
References:
http://www.postgresql.org/docs/8.2/interactive/sql-comment.html
http://dev.mysql.com/doc/refman/5.0/en/information-schema.html
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
ZK, AJAX without JavaScript?
ZK is a slick-looking presentation layer toolkit that seems to at least be growing in popularity on SourceForge. I do not know of any real sites using it. It looked very interesting at first glance, especially in conjunction with something like Hibernate. After some further digging, my second impression is that it suffers from roughly the same major flaw that afflicted the first iteration of exhibition. Namely, it presented some simple ways to do complex things, but when it really came down to it, the complexity was merely being moved elsewhere. Not just that, but the complexity was now being exposed using a technology few people know or understand. Am I missing something here, or is ZK just refactoring the complexities of developing an application for the web?