Refactoring exercises for inheritance versus composition in java