CodeOath
← All posts
Architecture & Patterns80 min total · 26 parts

ACID, SOLID, and Common Design Patterns: A Software Design Reference

Contents — Part 25 of 26: How These Three Layers Connect
Part 25 of 26 · ~1 min

How These Three Layers Connect

Diagram showing Design Patterns, SOLID Principles, and ACID Guarantees as three connected layers, tied together by one SaveOrder() example

A single concrete example ties every layer covered in this reference together. A Repository (a Structural pattern) hides EF Core behind an IOrderRepository interface, satisfying Dependency Inversion (a SOLID principle), which is what lets OrderService be unit tested against a fake repository with zero real database involved. When that repository's SaveOrder() actually runs against a real database, it executes inside a single transaction relying on Atomicity (so a crash mid-save can't leave a half-written order) and an appropriate Isolation level (so a concurrent read of that order never sees it half-written either) — two ACID guarantees the calling code never has to implement itself, only invoke correctly. Design patterns are the shapes; SOLID is why those shapes were chosen instead of simpler-looking alternatives; ACID is the floor the database gives every one of those transactions to stand on.