🏠 Inicio
Pruebas de rendimiento
📊 Todos los benchmarks 🦖 Dinosaurio v1 🦖 Dinosaurio v2 ✅ Aplicaciones To-Do List 🎨 Páginas libres creativas 🎯 FSACB - Showcase definitivo 🌍 Benchmark de traducción
Modelos
🏆 Top 10 modelos 🆓 Modelos gratuitos 📋 Todos los modelos ⚙️ Kilo Code
Recursos
💬 Biblioteca de prompts 📖 Glosario de IA 🔗 Enlaces útiles
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.