Separation of Concerns
Pronunciationsep-uh-RAY-shun uv kun-SERNZ
Definition
Organizing code so each part has one clear job, for example data access, business rules, and display are kept apart.
Where you hear it
Code reviews and architecture discussions.
Examples
This controller also sends emails. Let's separate the concerns.
Good separation of concerns makes testing easier.
Moving the SQL out of the view is separation of concerns: the view only displays data.
Common mistake
Splitting code into so many tiny layers that nobody can follow it. Separate only what really changes for different reasons.
Don't confuse with
Separation of Concerns is often mixed up with Single Responsibility Principle, but while SoC is a general architectural design principle for dividing a system into distinct features, SRP is a specific object-oriented principle stating that a class should have only one reason to change.
Say it at work
- In a meeting or chat
We need better separation of concerns here so that business logic isn't mixed directly with the UI components.
- In an email or ticket
Please refactor this module to ensure proper separation of concerns before we merge the pull request.
Keep exploring
More in Architecture & Design