educative.io

Educative

"I was never a fan of SP" - N-Tier

Hey!!
So I am at the first chapter, and I bumped into this phrase in context of single reponsibility principle.
Well not that I am a big expert in SP (stored procedures) but I went to check all the other devs that really adore them, and they pointed out some interesting pros like Security and Performance.
What do you think about this?

This seems to be a matter of preference. The author points out why he doesn’t like stored procedures. He wants separation of concerns. He wants his database to be about storing data and executing that task perfectly so he prefers to keep business logic out of the database.

You can form your opinion on this once you get more experience.

Good luck!

@Yuval_Lombard From the lesson,

Stored procedures enable us to add business logic to the database, which is always a big no. What if, in the future, we want to plug in a different database? Where do we take the business logic? Do we take it to the new database? Or do we refactor the application code and squeeze in the stored procedure logic somewhere?

A database should not hold business logic. It should only take care of persisting the data. This is what the single responsibility principle is, which is why we have separate tiers for separate components.