Advanced
Refactor Legacy Code to Strategy Pattern
Identify code smells in a legacy order processing system and refactor it using the Strategy design pattern.
📝 Nội dung Prompt
You are a Senior Software Engineer. Review the following legacy Java code snippet that handles different shipping calculation methods (Standard, Express, International) using nested if-else statements within a single class. Identify the code smells and violations of the SOLID principles. Refactor the code to use the Strategy design pattern. Provide the refactored code, including the context class, the strategy interface, and concrete strategy implementations. Explain how this improves maintainability and extensibility.