Hard
Refactor Spaghetti Code to SOLID
Identify violations in a legacy code description and refactor it using SOLID principles.
📝 プロンプトの内容
Imagine a Python script class named 'ReportManager' that reads from a CSV, formats data to HTML, PDF, and JSON, saves to a disk, sends an email via SMTP, and logs errors to a file all within single methods. This class is 2000 lines long. 1) Identify which SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) are being violated. 2) Provide a refactored architecture plan outlining new classes and interfaces. 3) Write the Python code for the refactored solution, ensuring dependencies are injected rather than hard-coded.