🏠 الرئيسية
المقاييس
📊 جميع المقاييس 🦖 ديناصور v1 🦖 ديناصور v2 ✅ تطبيقات قائمة المهام 🎨 صفحات حرة إبداعية 🎯 FSACB - العرض النهائي 🌍 مقياس الترجمة
النماذج
🏆 أفضل 10 نماذج 🆓 نماذج مجانية 📋 جميع النماذج ⚙️ كيلو كود
الموارد
💬 مكتبة الأوامر 📖 قاموس الذكاء الاصطناعي 🔗 روابط مفيدة
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.