At the top of the Price.cs class on page 40 there is the line:
private IDiscountStrategy _discountStrategy = new NullDiscountStrategy();
Which defaults the Price to use the null discount strategy. My question is why don't we use this instead:
private IDiscountStrategy _discountStrategy;
public Price( decimal rrp, decimal sellingPrice )
_discountStrategy = DiscountFactory.GetDiscountStrategyFor( CustomerType.Standard );
In this way the Price class is not directly dependent on the NullDiscountStrategy class, although is now has dependencies on the factory method and the CustomerType enumeration.
I would like to know whether this would be considered an improvement to the code or does it not really make any difference? I seem to get bogged down in little things like this!