🏠 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
advanced

Identify and Refactor God Class Anti-Pattern

#clean-code #refactoring #domain-driven-design #architecture

Analyze a hypothetical 'God Class' scenario and propose a refactoring strategy using Domain-Driven Design principles.

You are presented with a monolithic Java class named 'OrderManager' that is 4000 lines long. It handles database connections, business logic for discounts, email notifications, PDF generation, and logging. Analyze this 'God Class' anti-pattern and propose a comprehensive refactoring plan. 1) Identify the specific responsibilities within the class that violate the Single Responsibility Principle. 2) Propose a new package structure based on Domain-Driven Design (DDD) principles, defining Entities, Value Objects, Repositories, and Domain Services. 3) Write pseudo-code demonstrating how you would extract a complex pricing calculation into a dedicated Strategy Pattern implementation. 4) Explain how dependency injection would be utilized to decouple the new components.