add factory, abstractfactory design patterns, and try to use jasmine to test