Explore systems.
Interactive architecture diagrams
Design patterns explorer
Strategy
Encapsulate interchangeable algorithms behind an interface. Example: pricing strategies.
Factory
Centralize creation logic when construction depends on a configuration or invariant.
Adapter
Translate an external interface into the interface your application expects.
Decorator
Wrap an implementation to add behavior without changing its contract.
PHP examples playground
Adjust the input to explore a PHP expression. Results are simulated in JavaScript; no arbitrary PHP execution.
function double(int $n): int { return $n * 2; }Result:
System design case studies
Reliable asynchronous order processing
Use an outbox to atomically store events alongside changes; consumers handle duplicate delivery with idempotency keys. Trade-off: eventual consistency and operational complexity.
Read-heavy catalog service
Use cache-aside with TTL and request coalescing. Measure hit rate and stale reads; keep the database authoritative. Trade-off: freshness versus latency.