advanced
Legacy Code Refactoring Strategy
Analyze a hypothetical legacy codebase scenario and propose a refactoring strategy using design patterns.
📝 Contenu du Prompt
Act as a Lead Software Engineer. You are presented with a hypothetical legacy Java class named 'OrderManager' that is 2000 lines long, contains static mutable state, mixes database access with business logic, and has no unit tests. Propose a step-by-step refactoring strategy to break this class down. Identify which Design Patterns (e.g., Factory, Repository, Strategy, Decorator) are appropriate to apply. Explain how you would introduce test coverage without breaking existing functionality, using the 'Strangler Fig' pattern concept where applicable.