add designpatterns demo code