Sample code for design patterns