added design patterns code