Common design patterns implemented in Java