design factory and strategy pattern