Thursday, March 22, 2007

The beauty of having your business logic in the database...

You may recall that I banged together a small application using Apex (nee HTMLDB) a few months ago. I got a call from a user the other day that something wasn't working quite right. Seems as one of the pages was giving them an incorrect result. I hadn't touched this particular application in about 2 months, but I knew it pulled information from a view I created just to make the Apex interface easy. The view called a piece of PL/SQL code that calculated a particular metric on-the-fly and due to some business rules, that calculation changed. It was a business-wide change, so I consulted the parties that use this package and we all agreed on the change to be made. I made the change and everybody was happy. I didn't have to get back into Apex or anything, just a simple PL/SQL change and I was done.

For those people that thought they had a better idea and rewrote the business logic in their Java middle-tier, good luck.

3 comments:

Graham said...

I've given up trying to persuade java developers of the advantages of keeping it in the db. It seems that java developers are being churned out from school with a mentality of 'business logic in the db = evil', with no thought whatsoever towards some logical discussion. The only argument I ever seem to hear is - 'it's wrong'.

John Scott said...

Jeff, I couldn't agree more, using APEX is a great tool which encourages you to keep your code and logic in the DB for precisely the reasons you mention.

John.

Anonymous said...

Most of the younger developers I have seen in the last 5 to 10 years don't understand presentation layer versus business logic.

Is it any surprise that everything is coded in applications developed by people like that?

Java or VB or Csharp it doesn't matter if you don't know how to develop app's the same things come back time and again.