Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very Interesting. Never heard this before.

Can you give some examples of what would constitute declarative business logic vs imperative business logic?



Declarative 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: