Some articles regarding design philosophies:
Domain models: rich or anemic? World is at fire, both have advantages, disadvantages.
Personally, I'm more of a data-driven anemic model.
Where business logic is governed by the business layer, and persistance by the persistance layer, the question is where the domain model resides. I like it more in the persistance layer. This does allow one to hopelessly mutilate the domain model in not allowed ways, but it also SOLID, since it only has one responsibility.
http://techblog.bozho.net/on-domain-driven-design-anemic-domain-models-code-generation-dependency-injection-and-more/
https://blog.inf.ed.ac.uk/sapm/2014/02/04/the-anaemic-domain-model-is-no-anti-pattern-its-a-solid-design/
http://stackoverflow.com/questions/23314330/rich-vs-anemic-domain-model
And of course wikipedia:
https://en.wikipedia.org/wiki/Anemic_domain_model
For me, this is also because I'm not much of an OO-fan. Luckily, I'm not the only one:
http://www.yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html
now onto another biggie: fail-fast vs robustness.
Ideally, I'd like to to all my validation in the validation tier, i.e. in (or before) the front of the application. But it's reeeeeeeeeeeeeaaaally easy to just ad that if(something != null) in front of that callMyFunctionWhichUses(something)... Which is a bad thing, because now I've added complexity to my wonderful code, and a separate path. And from there, I might violate business concerns since I accidentily do not do critical stuff. And then I have to debug *why* I didn't do that critical stuff. And it's really hard. So ideally, I don't want that code... Unless it's going to a different system which should support it. If I have a call to a different system with optional fields, most of the time it's easier to just assume that my data is correct, and straight-through fill it to the external system. It'll have its own validation, and it'll tell me when I'm wrong, right?
Hmmm... maybe there's a fallacy there ;)
In any case, some articles:
http://www.yegor256.com/2015/08/25/fail-fast.html
We really should add wikipedia's here: https://en.wikipedia.org/wiki/Robustness_principle
And be aware that it has it's cost. It means deviating from specs for easy, forgiving applications. This, howver, in turn restrict us in further refactoring, since all of a sudden working code might break even if it still is up to spec, since bugs in neighboring code might accidentally use those undocumented features.
Domain models: rich or anemic? World is at fire, both have advantages, disadvantages.
Personally, I'm more of a data-driven anemic model.
Where business logic is governed by the business layer, and persistance by the persistance layer, the question is where the domain model resides. I like it more in the persistance layer. This does allow one to hopelessly mutilate the domain model in not allowed ways, but it also SOLID, since it only has one responsibility.
http://techblog.bozho.net/on-domain-driven-design-anemic-domain-models-code-generation-dependency-injection-and-more/
https://blog.inf.ed.ac.uk/sapm/2014/02/04/the-anaemic-domain-model-is-no-anti-pattern-its-a-solid-design/
http://stackoverflow.com/questions/23314330/rich-vs-anemic-domain-model
And of course wikipedia:
https://en.wikipedia.org/wiki/Anemic_domain_model
For me, this is also because I'm not much of an OO-fan. Luckily, I'm not the only one:
http://www.yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html
now onto another biggie: fail-fast vs robustness.
Ideally, I'd like to to all my validation in the validation tier, i.e. in (or before) the front of the application. But it's reeeeeeeeeeeeeaaaally easy to just ad that if(something != null) in front of that callMyFunctionWhichUses(something)... Which is a bad thing, because now I've added complexity to my wonderful code, and a separate path. And from there, I might violate business concerns since I accidentily do not do critical stuff. And then I have to debug *why* I didn't do that critical stuff. And it's really hard. So ideally, I don't want that code... Unless it's going to a different system which should support it. If I have a call to a different system with optional fields, most of the time it's easier to just assume that my data is correct, and straight-through fill it to the external system. It'll have its own validation, and it'll tell me when I'm wrong, right?
Hmmm... maybe there's a fallacy there ;)
In any case, some articles:
http://www.yegor256.com/2015/08/25/fail-fast.html
We really should add wikipedia's here: https://en.wikipedia.org/wiki/Robustness_principle
And be aware that it has it's cost. It means deviating from specs for easy, forgiving applications. This, howver, in turn restrict us in further refactoring, since all of a sudden working code might break even if it still is up to spec, since bugs in neighboring code might accidentally use those undocumented features.
Reacties
Een reactie posten