Tuesday, November 6, 2007

More wasted time today

This week, I spent (read: wasted) a lot of time.

  1. Some database did not have a foreign key constraint, and a user removed some data that was referenced elsewhere.
  2. Some customer managed to call a function, passing an object that had just the appropriate method names, but was definitely not the appropriate object.
  3. I needed to map object properties to fields in a CSV file. By name.

Why? Again because the constraints are not at the right place. When you remove data from a database, some other place that relies on that data to be present will fail. It will fail much after the original cause. And that's where you lose all your time, trying to get back in time from the error message to the actual event.

Dynamic typing is like doing that all the time. You do not get an error message when you call a method with the inappropriate arguments. It may be some totally unrelated piece of code that fails.

Now, you might say, my database was not very well tested. That is true, it's entirely my fault that the integrity constraint was not there. Or was it? The constraint can be removed at any time, by anyone. I do not have a guarantee that my constraint is still there in production code. Welcome to dynamic programming!

Not for me, thank you.