// SOLID & Principles · 07
KISS
Keep It Simple, Stupid: prefer what a newcomer can read and change.
How it fits together
- OrderEndpoint uses / calls OrderFacade
- OrderFacade uses / calls OrderService (forwards)
- OrderEndpoint uses / calls OrderService
Spot it
- Only the author can explain how it works
- A generic framework for one use case
- Layers that only forward calls
It costs
Too simple for known needs means rework later; simple is not the same as naive.
In code
public sealed class OrderService(OrderStore store){ public async Task PlaceAsync(Order order, CancellationToken ct) { if (order.Lines.Count == 0) { throw new InvalidOperationException("An order needs at least one line."); } order.Total = order.Lines.Sum(line => line.Price * line.Quantity); await store.SaveAsync(order, ct); }}public sealed class OrderEndpoint(OrderService orders){ public Task PostOrderAsync(Order order, CancellationToken ct) => orders.PlaceAsync(order, ct);}Go deeperThe full explanation and what to ask for · 1 min readExpandCollapse
KISS targets accidental complexity: what we add through our own choices, as opposed to the essential complexity of the problem itself.
Simple is not the same as easy or short. A clever one-liner can be harder to change than ten plain lines, and avoiding a needed abstraction is its own kind of complexity.
A practical test: can someone new to the code predict what it does and change it safely? If not, remove indirection before adding comments.
Ask for it
- accidental complexity
- essential complexity
- indirection
- cognitive load
- readability
Simplify this module without changing behaviour: remove pass-through layers, generic abstractions with a single implementation and configuration nobody sets. Keep the tests green and justify each removal in one line.