MVC separates application logic into three components: Model, View, and Controller.
- Model: Manages data, business logic, and state.
- View: Displays data to the user (UI components).
- Controller: Handles user input, interacts with model, updates view.
User → Controller → Model → View → User
- Clear separation of concerns.
- Easier testing and maintenance.
- Controller can become overly complex.
- Can lead to tight coupling between Controller and View.
- Web applications (e.g., Django, Ruby on Rails).
- Applications where UI and logic are clearly separated.
Similar to Clean Architecture; it's layered, focused on decoupling external dependencies from core logic.
- Domain Layer: Core domain logic and entities.
- Application Services Layer: Use cases and business logic orchestration.
- Infrastructure Layer: External resources (database, file system, etc.).
- Presentation/UI Layer: User interfaces and controllers.
Presentation/UI → Application Services → Domain ← Infrastructure
- Strong decoupling and testability.
- Easier to maintain domain purity.
- Requires clear discipline to avoid domain pollution.
- Can be overly structured for simpler apps.
- Complex applications with evolving business logic.
- Enterprise apps with strong domain models.