🏠 Home
Prestatietests
📊 Alle benchmarks 🦖 Dinosaur v1 🦖 Dinosaur v2 ✅ To-Do List applicaties 🎨 Creatieve vrije pagina's 🎯 FSACB - Ultieme showcase 🌍 Vertaalbenchmark
Modellen
🏆 Top 10 modellen 🆓 Gratis modellen 📋 Alle modellen ⚙️ Kilo Code
Bronnen
💬 Promptbibliotheek 📖 AI-woordenlijst 🔗 Nuttige links
Hard

Refactor Spaghetti Code to SOLID

#python #refactoring #clean-code #oop

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.