added factory pattern demo