Where to put your code – Database vs. Application?

Question :

Where to put your code – Database vs. Application?,

Answer :

I have been developing web/desktop applications for about 6 years now. During the course of my career, I have come across application that were heavily written in the database using stored procedures whereas a lot of application just had only a few basic stored procedures (to read, insert, edit and delete entity records) for each entity.

I have seen people argue saying that if you have paid for an enterprise database use its features extensively. Whereas a lot of “object oriented architects” told me its absolute crime to put anything more than necessary in the database and you should be able to drive the application using the methods on those classes?

Read More  Are foreign keys really necessary in a database design?

Where do you think is the balance?

Thanks,
Krunal

,

I think it’s a business logic vs. data logic thing. If there is logic that ensures the consistency of your data, put it in a stored procedure. Same for convenience functions for data retrieval/update.

Everything else should go into the code.

A friend of mine is developing a host of stored procedures for data analysis algorithms in bioinformatics. I think his approach is quite interesting, but not the right way in the long run. My main objections are maintainability and lacking adaptability.

Read More  Best implementation for Key Value Pair Data Structure?

That’s the answer Where to put your code – Database vs. Application?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you