advanced
Refactoring a Monolithic God Object
Develop a step-by-step refactoring strategy to break down a massive, tightly-coupled class into modular components.
📝 Conteúdo do Prompt
You are presented with a legacy 'OrderManager' class containing 15,000 lines of code. It handles database connections, business logic, email notifications, logging, and UI formatting. Create a detailed refactoring plan to decompose this class into a modular architecture adhering to SOLID principles. Your plan should include: 1) Identification of distinct responsibilities and the suggested new classes/interfaces. 2) A strategy for extracting methods without breaking existing functionality, including specific unit tests to write before extraction. 3) The use of design patterns (e.g., Strategy, Factory, Observer) to replace complex conditional logic. 4) A migration path that allows the system to remain functional incrementally throughout the process.