[jk] refactor the strategy pattern with factory method