Advanced
Refactoring Spaghetti Code to SOLID Principles
Identify violations of SOLID principles in a provided legacy code snippet and refactor it into a clean, modular architecture.
📝 プロンプトの内容
Here is a legacy class 'OrderManager' that handles database connections, email notifications, payment processing, and UI logging all in one method: [Pretend Code Snippet is Here]. Analyze this code for violations of the Single Responsibility Principle and Dependency Inversion Principle. Propose a refactored class structure using dependency injection. Write the new interfaces (IPaymentGateway, INotificationService, IRepository) and show the refactored 'OrderManager' class that delegates tasks to these interfaces.