4 ms·
Although I don't necessarily disagree with DDD, I think this article starts out with an odd premise--namely, that DDD is necessary simply because a scaffold sys
by ezekg 9y ago
Although I don't necessarily disagree with DDD, I think this article starts out with an odd premise--namely, that DDD is necessary simply because a scaffold system generated a controller that lets you update every attribute of a model, including one that should be read-only.
I've never once created an API that allowed such a thing (updating model attributes willy-nilly), which is essentially just a weird datastore. Instead of updating an account's balance directly via the /accounts/1 endpoint, you should instead associate the account with a transaction model, and create transactions (debit or credit) via /transactions that are then used to calculate the account's final read-only balance.
This seems more like a data modeling problem than a CRUD problem, and it makes the article's premise seem forced. I mean, you don't see Stripe letting me update my available balance directly, instead I have to use charges, invoices, and transfers.