Archive

Archive for the ‘Software design’ Category

Why foreign keys are important

October 14, 2010 Leave a comment

On one project, about two years ago, we have decided that we didn’t need relations in relational database.

So we deleted them. We just used tables for storage, almost like flat files.

At first, programming was easy, but then, we started implementing logic for relational integrity, and that was no easy task. We had to implement every “relation” manually in code…

After a while, we started using relations again. Relations are there for a reason. Sometimes it’s a pain in the neck to deal with them. But, it’s even worse without them.

In relational databases, just use relations. Many smart people have figured that out. Smarter than me, that’s for sure.

P.S. document databases also have some kind of “nesting” relations built-in.

Advertisements
Categories: Databases, Software design