# Kokonatt's Tech Blog A distributed durable log of random developer events. ## Blog Posts - [Immutability and Defensive State Design in Python](https://kokonatt.com/blog/python-immutability): Frozen dataclasses are the default for domain value objects, but they don't validate at runtime. msgspec.Struct closes that gap with a single type that decodes, validates, and stays immutable across the wire boundary and the domain layer. attrs and cattrs cover the same ground in two libraries, and pydantic only earns its place when the ecosystem integration matters. - [Cross-Cutting Concerns Without Constructor Over-Injection](https://kokonatt.com/blog/cross-cutting): 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. - [Dependency Injection: Wiring Clean Python Architectures](https://kokonatt.com/blog/decoupled-dependency-injection): Constructor-based dependency injection in Python: Composition Roots, pydantic-settings, and safe resource lifecycle management. - [Enforcing Modular Boundaries with Import Linter in Python](https://kokonatt.com/blog/modular-boundaries-import-linter): Import Linter enforces Python architectural boundaries at near-zero runtime cost. Benchmarked on three real OSS codebases (10k, 20k, 200k lines of Python). - [Hexagonal Architecture in Python: Building Decoupled, Testable Systems](https://kokonatt.com/blog/hexagonal-architecture-python): 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](https://kokonatt.com/blog/domain-driven-design-python): 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).