coderx writes:
You've already got a lot of good replies but I still feel the need to put my
2 cents in...
Quote
I sent him an email asking for his reasons not to use foreign keys
and he replied that they slow down the database and make it difficult
to delete records.
As others have stated, it doesn't slow down selects and may improve them,
and unless you are going way overboard you are not going to notice the
difference in updates/inserts/deletes, and FKs are *supposed* to make it
harder to delete!
Quote
This goes along with his attitude of not placing
any business logic such as constraints or triggers on the database,
his refusal to allow fields to be nullable, and changing most every
int column he finds into a tinyint column. Now he is my boss and I
will do as I am told, but I am beginning to think he is a junior
level programmer who somehow managed to get hired as a manager.
For your information, the code my boss writes in the application tier
usually involves writing business objects (native code compiled) that
encapsulates data access. Maybe he is so entranced with OOP that he
sees any business constraint outside of his native code as being
unsophisticated?
This isn't an OOP issue per se, though it does involve the argument of where
business rules belong. My answer to that is that there is a distinction that
can be made in most if not all cases between "business" rules and
"integrity" rules. IMO integrity rules belong in the database, business
rules (normally representing processes, not just simple constraints) belong
in the application or middle tier. Business processes are then simplified by
being able to depend on the database's integrity rules.
Counter to one other reply, I will say even in huge systems such as data
warehouse examples, integrity rules still belong in the database and are
even more crucial. While for the most part this consists in column
attributes (default or checked values, null constraints) and PKs/FKs, it
certainly can include triggers.
For stored procedures, I use them where there is a clear and meaningful
advantage for simplicity and/or performance, but I start by coding such
processes in the application and then moving them only if warranted.
--
Wayne Niddery - Logic Fundamentals, Inc. (
www.logicfundamentals.com)
RADBooks:
www.logicfundamentals.com/RADBooks.html
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson