Separation of concerns (source code)

= Separation of concerns
{wiki}

Assign distinct responsibilities to components with explicit interfaces, so one responsibility can change without requiring unrelated changes elsewhere. For example, a <model-view-controller> application separates domain state, presentation and input interpretation. The <Observer pattern> can communicate a coherent state change to several views while keeping concrete display details out of the model. The separation should follow actual responsibilities; multiplying classes without a clear boundary does not establish it.