|
|
|
|
|
by theptip
3340 days ago
|
|
> If you don't understand your data then you don't understand the problem. That's a rather sweeping statement, that many in the industry do not agree with. https://en.wikipedia.org/wiki/Domain-driven_design
https://martinfowler.com/ > If there's a business rule for how that data is handled then it's most consistent to define it in the [db] To be clear, you're proposing that all business rule validation should be implemented as stored procedures in the DB? One of my domain model aggregates consists of thousands of lines of code just enforcing business rules and constraints. Am I to put that all in the DB? |
|
And some who do
https://dataorientedprogramming.wordpress.com/tag/mike-acton...
I'm not going to appeal to authority here. I'm speaking from experience. We all know how source code gets over time with hundreds of programmers working on it. A clear, consistent specification of your data model, rules, invariants, and transformations is far more valuable than the abstract-soup of trying to model your business domain in source code. I think we can all agree that the less code there is to understand then the easier it is to verify it is correct.
Verifying the requirement that "when record A is written to the database then B is appended with the delta change if such and such is True" is guaranteed at the database level along with all of the other constraints on those relations. If it's nested in one of these rings behind an abstract factory somewhere it's harder to verify.
> Am I to put that all in the DB?
That's where I would start. But I'm not you and I don't understand the problem you're trying to solve.
My original point was that abstracting out the platform if you're not really concerned about switching platforms is a form of premature pessimization and a source of errors. If you control the platform, target the platform and don't bother with the abstractions.