chapter8 (strategy pattern)