🏠 Accueil
Benchmarks
📊 Tous les Benchmarks 🦖 Dinosaure v1 🦖 Dinosaure v2 ✅ To-Do List Apps 🎨 Pages Libres 🎯 FSACB - Showcase 🌍 Traduction
Modèles
🏆 Top 10 Modèles 🆓 Modèles Gratuits 📋 Tous les Modèles ⚙️ Modes Kilo Code
Ressources
💬 Prompts IA 📖 Glossaire IA 🔗 Liens Utiles
Advanced

Legacy Spaghetti Code Refactoring

#refactoring #legacy-code #clean-code #design-patterns

Analyze a monolithic legacy code snippet and propose a refactoring strategy to improve maintainability and testability.

You are presented with a hypothetical 500-line monolithic function written in a mix of C++ and procedural styles that handles flight booking logic. It contains global variables, goto statements, and deeply nested conditionals. Provide a step-by-step refactoring plan to convert this into a modular, object-oriented structure. Specifically, identify the 'Extract Method,' 'Replace Conditional with Polymorphism,' and 'Introduce Null Object' opportunities. Write the final refactored class pseudocode and explain how each change reduces cyclomatic complexity.