the code for studying design pattern