commit design pattern code