Layer separation: data, logic, and UI

  • Standard term
2 steps

Layer separation is a way of building software that keeps three kinds of work apart: the data (what gets stored), the logic (the rules that decide things), and the UI (what people see and click).

The layers talk to one another only through a few agreed requests, such as "save this record", and never reach into one another's insides. So a restyled screen leaves the rules and saved records alone, the rules can be tested without opening the app, and an AI agent has a smaller area to edit.

Where you’ll meet it

You ask your coding agent to make your family's chore tracker look cleaner. The new design looks great, and chores your kids finished yesterday now show as overdue. While restyling the page, the agent also rewrote the rule that decides when a chore is late.

What to do

Ask the agent to restore the overdue rule and keep the new design, then check that yesterday's chores no longer show as overdue. Next, have it move that rule out of the page's code into a separate part the page only calls on, so restyles leave it alone.

Easy to mix up

Does it tell you where the code runs?
Layer separation: data, logic, and UIFrontend
No, it applies in the browser and on the server alikeYes, in the visitor's browser or on their device

Check yourself

Your event sign-up page lists dates as 2026-10-09, and you'd like "Oct 9" instead. Which request to your agent keeps the change where it belongs?

Go deeperSeparation of concerns came first, and layer boundaries need not follow files

Edsger Dijkstra described separation of concerns in a 1974 essay as studying one aspect of a problem at a time while deliberately setting the others aside. Splitting an app into data, logic, and UI applies that habit to code. Model-view-controller, which Trygve Reenskaug worked out at Xerox PARC in the late 1970s, is an early version of the same split.

A boundary between layers need not line up with files or servers. One file can keep a clean boundary, and three files can lack one. Some concerns cross every layer, such as shared data types and accessibility, and a storage change can still force work on the rules.

Practice Second Brain

Or take the learning quiz on a mix of every set