designpattern sample codes