VIP 👤
🏠 الرئيسية
المقاييس
📊 جميع المقاييس 🦖 ديناصور v1 🦖 ديناصور v2 ✅ تطبيقات قائمة المهام 🎨 صفحات حرة إبداعية 🎯 FSACB - العرض النهائي 🌍 مقياس الترجمة
النماذج
🏆 أفضل 10 نماذج 🆓 نماذج مجانية 📋 جميع النماذج ⚙️ كيلو كود
الموارد
💬 مكتبة الأوامر 📖 قاموس الذكاء الاصطناعي 🔗 روابط مفيدة 🔌 واجهات API والموجّهات
Advanced

Advanced Legacy Code Refactoring

#python #refactoring #architecture #solid

Analyze a complex, monolithic Python function with high cyclomatic complexity and refactor it into a clean, modular architecture adhering to SOLID principles.

You are an expert software architect. I will provide a legacy Python function that suffers from high cyclomatic complexity, global state usage, and lack of error handling. Your task is to: 1. Analyze the code to identify its core responsibility and side effects. 2. Break it down into smaller, single-responsibility functions or classes. 3. Apply the SOLID principles rigorously. 4. Introduce proper type hinting and docstrings. 5. Refactor the logic to improve readability and maintainability without changing the external API behavior. Return the complete refactored code and a brief explanation of the design patterns used.