add factory pattern demo