Design patterns practice in Java