design pattern exercise