Core Architectural Patterns

This is an all inclusive guide to all essential architectural designs in programming with a focus on Kotlin / Android, including but not limited to MVVM, MVP, MVC, MVI, Clean Architecture, Layered, Hexagonal and others, providing descriptions and use cases for all of them.

1. MVC – Model-View-Controller

Purpose: Separates business logic, UI, and user input.

Structure:

Model ←→ Controller ←→ View

2. MVP – Model-View-Presenter

Improves MVC by separating the view logic from Activity.

Structure:

Model ←→ Presenter ←→ View

3. MVVM – Model-View-ViewModel

Modern pattern used in Android (Jetpack recommended)

Structure:

View ↔ ViewModel ↔ Model

4. MVI – Model-View-Intent (aka Redux)

Unidirectional architecture often used with Jetpack Compose.

Structure:

View → Intent → Reducer → State → View

5. Clean Architecture

By Uncle Bob. Great for large-scale apps with clear separation.

Structure:

Presentation → Domain → Data

·  Presentation: ViewModel, UI

·  Domain: UseCases, Entities

·  Data: Repository, API, DB

6. Layered Architecture (N-Tier)

Each layer has a specific role.

Layers:

Presentation → Business Logic → Data Access → DB/API

Similar to Clean Architecture but not strictly enforced by boundaries.

7. Hexagonal (Ports & Adapters)

Also called Onion Architecture or DDD-inspired.

Idea: Core app logic should be independent of frameworks.

Structure:

Core Domain

↑ ↓

Ports (interfaces)

↑ ↓

Adapters (APIs, DB, CLI, etc.)

8. Microkernel (Plugin-based)

  • Used in systems like IDEs or apps with a core + plugins.

9. Microservices

  • Split system into independently deployable services (usually backend-based).
  • Structure:

User Service ←→ Order Service ←→ Auth Service

Uses REST, gRPC, or message queues to communicate.

10. Event-Driven Architecture

Uses events and listeners to drive behavior

11. Service-Oriented Architecture (SOA)

Like Microservices, but more enterprise and heavyweight, e.g., SOAP web services.

12. Client–Server Architecture

One server and many clients (e.g., Android app + REST backend).

Comparison Table

PatternData FlowView Aware of Logic?Testable?Best For
MVCTwo-wayYes (Controller logic)LowWeb / Simple apps
MVPTwo-wayNoMediumAndroid legacy apps
MVVMTwo-wayNoHighAndroid Jetpack
MVI (Redux)One-wayNoVery HighJetpack Compose / KMP
Clean ArchitectureLayeredNoVery HighEnterprise apps
HexagonalLayeredNoHighDDD / Test-First Systems
MicroservicesN/ADistributedVery HighBackend, large systems