studying designpattern in java