5 ms·
> Minimizing the amount of busines logic in the dB is exactly what makes the dB structures long lasting. The trick is to keep declarative business logic in the
by krn 7y ago
> Minimizing the amount of busines logic in the dB is exactly what makes the dB structures long lasting.
The trick is to keep declarative business logic in the database layer, and imperative business logic in the application layer.
This allows a large team of developers to move quickly without breaking things.
- wiz21c 7y agothat's very well put. Thx!
- victor106 7y agoVery Interesting. Never heard this before. Can you give some examples of what would constitute declarative business logic vs imperative business logic?
- krn 7y agoDeclarative programming expresses the logic of a computation without describing its control flow. This new feature in PostgreSQL is a great example of that: generated columns (declarative logic) were introduced to reduce the need for triggers (imperative logic). In SQL, declarative logic consists of constraints, indexes, views, and prepared statements. They can significantly increase the efficiency and reliability of the entire system. Imperative logic is mostly triggers and stored procedures, both of which can become hard to maintain and scale.
- sorokod 7y agoHow does one logically follows from the other?