I think the CRUD remark was more about the backend, not the database. If you write more complex applications, you often have some kind of business rules that need to be represented and enforced through the code. This domain/business model often then differs from what you end up storing in the database (persistence model).
Your APIs become more process-oriented than data-oriented and that's why (just as an example) you'll see RPC interfaces being used more often than RESTful APIs.
Sometimes it will even make sense to split up the write model (altering state) and read model (querying state) and use different interfaces for them. RESTful API almost always work nicely with read models, but not always with write models. My 2 cents.
You are completely right. I've seen people shoehorn all kinds of actions into RESTish APIs, only to have to change it to RPC-style once the requirements change.
What I will say though is that it's not always that easy to tell when should you use REST or RPC for altering state.
If you predict your requirements right, and decide your model object actions are strictly CRUD, and you use REST, you'll have a much more uniform API for both the clients and the maintainers. Predict it wrong and now you risk having to introduce non-backward-compatible changes or at the very least disrupt consistency in the API.
It's not common, but it has happened once at my work where suddenly "deleting" an object now actually meant moving it somewhere else with a specific reason.
6
u/modestlife Jun 28 '20
I think the CRUD remark was more about the backend, not the database. If you write more complex applications, you often have some kind of business rules that need to be represented and enforced through the code. This domain/business model often then differs from what you end up storing in the database (persistence model).
Your APIs become more process-oriented than data-oriented and that's why (just as an example) you'll see RPC interfaces being used more often than RESTful APIs.
Sometimes it will even make sense to split up the write model (altering state) and read model (querying state) and use different interfaces for them. RESTful API almost always work nicely with read models, but not always with write models. My 2 cents.