Category: architecture

← Back to all posts

Cross-Cutting Concerns Without Constructor Over-Injection

pythonarchitecture·by Adrian Benavides·August 3, 2026·6 min read

Use contextvars.ContextVar for cross-cutting concerns that almost every service needs, without threading them through every constructor. Covers per-task isolation, structlog and opentelemetry designs, sync-vs-async leaks, and the failure modes that show up in production.

Hexagonal Architecture in Python: Building Decoupled, Testable Systems

pythonarchitecture·by Adrian Benavides·July 10, 2026·9 min read

Build decoupled, testable Python systems with Hexagonal Architecture. Covers ports, adapters, driven/driving roles, structural typing with Protocol, and the pitfalls of port proliferation, primitive obsession, and infrastructure leakage.

Domain-Driven Design in Python: Preventing the Big Ball of Mud

pythonarchitecture·by Adrian Benavides·July 2, 2026·11 min read

Apply DDD tactical patterns in Python with immutable value objects, aggregate roots, and bounded contexts (the modular monolith default, the modern tooling landscape, and when DDD is overkill).