4 ms·
While I heartily agree with limiting complexity as a ground rule, the example given is not a great one. First, it’s more about repetition/poor design than comp
by ricardobeat 2y ago
While I heartily agree with limiting complexity as a ground rule, the example given is not a great one.
First, it’s more about repetition/poor design than complexity. Second, creating a separate service class for applying a discount is adding unnecessary complexity. You’ll end up with a pile of DiscountService, TaxService, ShippingCostsService, and so on, and they will be sewn together like patchwork. It seems to be a common pattern in Java but surely there are better ways?
- marcosdumay 2y ago> You’ll end up with a pile of DiscountService, TaxService, ShippingCostsService, and so on This seems reasonable. If you get a lot of complexity on each one of those, and their behavior is controlled by different areas of your business, there's nothing bad in segregating them.