Advanced
Legacy Code Refactoring Strategy
Develop a refactoring plan for a 'God Class' in a legacy Java codebase to improve testability and adherence to SOLID principles.
📝 プロンプトの内容
You have inherited a legacy Java application containing a class named 'TransactionManager' that is 4000 lines long. It handles database connections, HTTP requests, logging, business logic validation, email notifications, and file parsing. It has 50 public methods and relies heavily on static utility classes. 1. Propose a step-by-step refactoring strategy to break this class down without breaking existing functionality. 2. Identify which SOLID principles are currently being violated. 3. Suggest specific Design Patterns (e.g., Strategy, Factory, Decorator) to apply during the refactoring process. 4. Write pseudo-code or actual Java code snippets showing how you would extract the 'email notification' logic into a separate component and inject it.