by larsmak · 12y ago · 0 comments
For example a method to calculate the value of an asset portfolio could return the value of the portfolio and the set of assets that are missing prices in a single call rather than having to make two separate ones (and potentially two iterations through a data collection). Cleaner to be able to return a number (or a money class) and a set of assets rather than having to return CalculationResult. As a bonus you also get to dodge the hardest problem in programming, naming things ;)
Most of my issues with Java stem from violations of Occam's Razor of this manner.
Compare with say Python where introducing classes is much less necessary and ends up with cleaner and clearer designs.