learn design pattern in Java