Business rules inside the dabase - how to avoid
Dears,
I have a friend who is working on our project and he is an
Oracle DBA. The problem is that he's been very stubborn when it
comes to the app's business rules. He insists that all of the
business rules should be inside the database, represented by
triggers, stored procedures and the likes.
Even the applications's parameters should go into the database,
according to him. "Property files ? Hell no !"
I tried to convince him of the importance of OO design principles,
abstraction, blah blah blah but he won't listen.
Does any of you guys know of a link or an article available on
the web that addresses this discussion ?
I wanted to persuade him, instead of forcing him to accept our
design decisions.
I mean, I know we all have to be reasonable but I wanted to
have something written by some of the OO gurus, it would be
easier...
Thanks a lot
[964 byte] By [
maxsena] at [2007-9-28 15:26:32]

Find someone else to be your DBA.
> He insists that all
> of the
> business rules should be inside the database,
> represented by
> triggers, stored procedures and the likes.
ask him how this will work when your application must participate in an XA (2-phase) transation
ask him to explain why you have n java developers and 1 DBA
escalate this issue to management - does management want to support DB-vendor proprietary code or not?
> Even the applications's parameters should go into the
> database,
> according to him. "Property files ? Hell no !"
ask him how to determine the database connection parameters
> I tried to convince him of the importance of OO design
> principles,
> abstraction, blah blah blah but he won't listen.
get rid of him - he'll only get worse over time
> Does any of you guys know of a link or an article
> available on
> the web that addresses this discussion ?
search for Ambler - he's got a good whitepaper, but I can't recall URL
> I wanted to persuade him, instead of forcing him to
> accept our
> design decisions.
it sounds like you've tried to persuade him, now get out the bulldozer and plow through his objections
Finding a case study for what you speak will not be easy, and I suspect will do little to sway the opinion of your DBA. If you do find something, please post it to the list here.
Here are the fundamental problems with his approach (feel free to use these arguments against him):
1) Business logic is hidden / spread across multiple tiers. This is a biggie. If you are using triggers, etc you have business logic that is spread across both the actual code level and across the DB. For a developer that is going to implement a change you have effectively doubled the cost of that change. Plus your development team has to be well versed in both Java coding and in SQL / DB specific coding as well - if your DBA is doing proprietary things in Oracle... well, you get the picture.
2) Changes to DB. If you ever change DB solutions, or even want to switch to a new set of tables, you have to replicate all of that work. There is no real reason for doing that with todays technology - you are just creating more work and making your system(s) less flexible to change and more challenging to migrate.
3) Object / DB disconnect. When you get into the guts of things, there is a wide gap between what is considered best practices for DB design and what is considered best practices for OO design. This culminates in a lot of work going into how to map objects to DB's and vice versa. The differences between these paradigms can cause huge problems when you are implementing business logic in both tiers. Here is an example:
Let's say that you have a universal rule that states that you must have a full 9 digit zip code for all addresses. In the object world this type of rule implementation is simple - you simply enforce this rule on your Address object and use it everywhere you need an address. But in the DB world it is a common practice to embed this type of data within other tables. For instance, you have a customer table with address fields. Same thing for employees, vendors, etc.
Now in order to enforce that 9 digit rule you have to create a stored procedure (or a constraint, whatever) on each of the tables that contains address data. Add a new table with address data? Re-create the rule enforcement.
4) People - As you had mentioned (or maybe someone else did), most companies follow this formula; coders > DBA's. And they do it for good reason. By making the DBA the gate keeper for all of the rule logic you are increasing your "bus" risk factor (he gets hit by a bus, your company is screwed). Plus he is certainly increasing his own job security (I call this complexity based job security - the more complex I can make my work seem, the less likely anyone is to fire me). If I were to perform a risk assessment here I would definitely want my larger group of coders handling rule logic.
Hope this helps.
Jonathan House
Yes,
I was able to persuade the DBA without any kind of brute force.
In the end, he almost confessed to me he was feeling kind of
threatened by the fact that his importance to the
project at this time was getting smaller.
The problem was that he volunteered to join the project as a
programmer because he wanted to broaden his resume and wanted
to learn java but OO brought him some difficulties so he
rushed back to DBA assignments...
It is difficult for him to let go some of the ideas he's been
with for the past years.
Anyway, thank you guys for the ideas