sample codes about design patterns