🏠 Home
Benchmark
📊 Tutti i benchmark 🦖 Dinosauro v1 🦖 Dinosauro v2 ✅ App To-Do List 🎨 Pagine libere creative 🎯 FSACB - Ultimate Showcase 🌍 Benchmark traduzione
Modelli
🏆 Top 10 modelli 🆓 Modelli gratuiti 📋 Tutti i modelli ⚙️ Kilo Code
Risorse
💬 Libreria di prompt 📖 Glossario IA 🔗 Link utili
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.