Monday, February 5, 2007

About DB-Design

Here just another insight from the Lookup Table Madness article:

Remember that the primary reason to use a database is not to "persist data"; that can be done more efficiently with file-based systems. The purpose of a relational database is to enforce the rules that govern how data is to be created, maintained and used; in other words the database enforces the rules that give the data meaning.Without those rules your data becomes a meaningless tangle of 1's and 0's. In database design, the first and foremost consideration should always be logical correctness; all other concerns are secondary.

I repeat:

In database design, the first and foremost consideration should always be logical correctness; all other concerns are secondary.

This means:

  • Do not think about performance, when you design your DB-model. Changes to improve performance should be made  in a second iteration and consciously declared as deviation from the optimal model.
  • Introduce constraints as early as possible. It may be tedious in the beginning to work with a highly constrained data-store, but it forces your application to behave correctly. This is according to the Fail Fast Principle. Introducing constraints late will certainly force you to test the whole application again and probably force you to rework a lot of the application. Also introducing new constraints on an existing set of data can be painful.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...