In the same situation, I would break the "silent data object rule", since I do not expect this particular calculation to change often. I would probably use it as a getter.
For more complex scenarios, it makes sense to create an OrderCalculator class that accepts classes related to order and can perform all kinds of calculations, such as tax included, field measurement, etc. In this way, you delegate settlement responsibilities outside of CustomerOrder. Thus, CustomerOrder does not need to be aware of Texas state tax in order to determine if a sales tax is needed, for example.
source
share