Exercising some OOP design patterns in Java