Business Logic: Database Vs Code

Vineet Mishra
Jul 30, 2022

Hi All, I was sitting one day and wondering one day which would be more suitable to write your business logic in code or database let's see the pros & cons

Database

Pros:

If you need to change the language, almost all logic will be in the database; therefore, the implementation time will be minimal.

Changes in the language are more common than in the database.

Cons:

You can’t debug in database

Direct involvement of the database is not a good practice

Code:

Pros:

You can debug the code

scalability

Provide one more layer to the database

Cons:

You need to change whole code if you taking new Tech stack

--

--

Vineet Mishra

SDE 2 at Accelya , I write about Mobile/Web Development and Deployment, and Interview Q & A