Archive for May, 2009

Coding Horrors: MySQL, Dates and Times

An excerpt from MySQL Reference Manual:

Illegal DATETIME, DATE, or TIMESTAMP values are converted to the “zero” value of the appropriate type (’0000-00-00 00:00:00′ or ‘0000-00-00′).

What the fuck.  Really, come on.  The purpose of a database is to store valid and integral data.  Again.  Valid.  And.  Integral.  Data.  It is valid, integral and meaningful that counts.  Not just any rubbish.  If I want rubbish, I can just read back random bytes from the harddisk.  If someone tries to write crap into a database, which the database cannot handle, the database must refuse the operation, and give error. 

Really, I wonder what the hell designers of MySQL were thinking when they implemented this specific feature.  Pardon me, the word “feature” is not appropriate.  The correct word would be “disaster”.  It is a disaster indeed, because it silently causes data loss.  One might argue that it is developers’ responsibility to validate their data, and make sure they provide the database with valid input.  While this is definitely true, it is no excuse for the database to accept graciously any garbage, and on top of that convert it to something which has nothing to do with what it is supposed to be.  That is a major fail in design, and major fail to achieve a primary goal.

The behavior above is true for MySQL versions from 4.1 to 6.0.

This little story only proves that MySQL is only good as a backend for small and simple websites.  If you mean serious business, please reconsider.  There are a bunch of free databases out there, all of them much, much better and more mature.  Some of them even open source.

And yes, I know there is a general setting in MySQL 5.02 and greater to make it give errors.  And yes, I don’t think it makes the fail lesser.

Posted by Nik on May 27th, 2009 2 Comments

Rant: Moving Targets

A trip back in time.  In 2000 we were starting a large project.  The architecture was pretty standard stuff – database server, application server with business objects, semi-thin desktop client, featuring bi-directional communication between the clients and the server.  All were Windows native applications.  During the design phase the question about the inter-tier communication technology came up.  Back then, Windows DNA1 was the super-dee-duper stuff out there, praised by Microsoft as the prime guide to making distributed applications.  We decided to follow its wisdom, and built the communication layer on top of Distributed COM and COM+.  Oh, why, why?

(more…)

Posted by Nik on May 25th, 2009 No Comments