VIP 👤
🏠 Início
Avaliações
📊 Todos os Benchmarks 🦖 Dinossauro v1 🦖 Dinossauro v2 ✅ Aplicações To-Do List 🎨 Páginas Livres Criativas 🎯 FSACB - Showcase Definitivo 🌍 Benchmark de Tradução
Modelos
🏆 Top 10 Modelos 🆓 Modelos Gratuitos 📋 Todos os Modelos ⚙️ Kilo Code
Recursos
💬 Biblioteca de Prompts 📖 Glossário de IA 🔗 Links Úteis 🔌 APIs e roteadores
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.