🏠 Accueil
基準測試
📊 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 📖 人工智能詞彙表 🔗 Liens Utiles
advanced

Refactor Spaghetti Code into SOLID Principles

#coding #refactoring #architecture #design-patterns

Analyze a poorly structured monolithic function and refactor it into a modular architecture adhering to SOLID principles.

You are a Senior Software Engineer specializing in clean code and architectural design. Analyze the following legacy code snippet which suffers from tight coupling, god object anti-pattern, and lack of abstraction. Refactor the code into a language-agnostic pseudo-code structure that adheres strictly to SOLID principles. Specifically, break it down into distinct classes with clear responsibilities, utilize dependency injection where appropriate, and implement design patterns (such as Strategy or Factory) to eliminate conditional logic sprawl. Provide the refactored architecture and a brief explanation of how each SOLID principle is applied in your solution.