Skip to content
Katabench
Try free

Topic

Architecture & Design

Patterns and design choices for .NET systems that need clear boundaries, reliable messaging, and room to change.

Practice this topic: C# architecture exercises →

Try Two Sides of the Hexagon → Free, no account needed

Latest articles

RSS feed →

18 articles

Strangler fig pattern for replacing legacy behind a seam

Architecture & Design 8 min read

The strangler fig pattern replaces legacy code route by route. A shadow run found 31 mismatches in 1,000 generated policies before any caller saw one.

Read article →

Domain events vs integration events: where each belongs

Architecture & Design 8 min read

Domain events vs integration events: one is a private fact inside a transaction, the other a public contract, and a one-field rename shows why they differ.

Read article →

Result pattern in C#: when it beats exceptions

Architecture & Design 8 min read

The result pattern in C# puts expected failure in the signature. A returned rejection ran about 160 times faster than a throw, which is rarely the best reason.

Read article →

CQRS pattern from one database up, and what each step costs

Architecture & Design 8 min read

The CQRS pattern can start in one database: a demo queue page went from 2,000 hydrated comment rows to 50 integers before any second store existed.

Read article →

Modular monolith: what makes a module boundary real

Architecture & Design 8 min read

A modular monolith holds only when crossing a boundary fails a build or a query. Three checks separate real modules from folders with good names.

Read article →

API Backward Compatibility During a Rolling Deployment

Architecture & Design 8 min read

Preserve API backward compatibility while old clients and servers coexist. Design additive contracts, safe defaults, and tests for staged HTTP rollouts.

Read article →

Distributed tracing in .NET with OpenTelemetry

Architecture & Design 9 min read

Timeout in service C, silence in A and B: context never propagated. How traceparent, ActivitySource, and OpenTelemetry turn three logs into one trace.

Read article →

Saga pattern in .NET: compensating transactions, not 2PC

Architecture & Design 9 min read

Split checkout across services and rollback stops existing. Build a .NET saga: persisted orchestrator steps, compensations, a pivot, and idempotent retries.

Read article →

Aspire Service Discovery: Names, Ports, Replicas

Architecture & Design 7 min read

Learn how Aspire service discovery turns logical names into endpoints with WithReference, HttpClient resolution, health checks, and replica load balancing.

Read article →

Circuit Breaker Pattern in .NET with Polly

Architecture & Design 9 min read

Build a circuit breaker in modern .NET with Polly and HttpClient resilience. Tune the failure window, compose retries safely, and prove recovery.

Read article →

Message Queue vs Event Bus: Choose the Topology

Architecture & Design 8 min read

Compare message queues, event buses, and pub/sub by delivery topology. Choose competing workers or fan-out, then design retries and ordering honestly.

Read article →

Structured Logging in .NET: Write Logs You Can Query

Architecture & Design 7 min read

Learn structured logging in .NET with ILogger message templates, named fields, scopes, correlation IDs, safe data handling, and query-first design.

Read article →

Transactional outbox pattern in .NET: publish without losing messages

Architecture & Design 7 min read

Saving data and publishing an event are two writes that can disagree. Build a transactional outbox with EF Core, a retrying publisher, and idempotent consumers.

Read article →

AddSingleton vs AddScoped vs AddTransient: what each promises

Architecture & Design 8 min read

AddSingleton vs AddScoped vs AddTransient in plain terms: what each lifetime promises, sensible defaults, and the captive dependency bug that ships.

Read article →

Caching strategies: cache-aside, invalidation, and stampedes

Architecture & Design 8 min read

Caching strategies from the cache-aside flow to the hard parts: invalidation owned by a human and stampedes tamed by single-flight and jitter.

Read article →

Architecture fitness functions: tests that fail the build when your layers rot

Architecture & Design 6 min read

Architecture decays because nothing fails the build when the domain references the DbContext. ArchUnitNET fitness functions assert layering rules in CI.

Read article →

Hexagonal architecture in .NET without the dogma

Architecture & Design 6 min read

Ports and adapters in plain C#: domain in the center, ports as interfaces, adapters as infrastructure. Why it beats layered spaghetti, and when it is overkill.

Read article →

Dependency inversion in C# is not about your DI container

Architecture & Design 6 min read

The D in SOLID is the most quoted and least applied principle. Dependency inversion means owning your abstractions and pointing dependencies inward.

Read article →

Get new katas and .NET tips in your inbox

A short note when fresh kata land, plus the C# and performance tricks behind the grading. No spam, unsubscribe anytime.