[refactoring] Add replace type code with state or strategy.