Separation of Concerns
What is Separation of Concerns?
In computer science, separation of concerns is a design principle for separating a computer program into distinct sections. Each section addresses a separate concern, a set of information that affects the code of a computer program.
- Wikipedia
In other words: It’s a method or series of Software Design Principles to architect your application so that each major “concern” is handled in its own space. This helps the program to be easier to be added upon and extended in the future.
Layers
The different layers of “concern”, or larger categories of concerns.
Presentation
- UI code for presenting data to users and receiving user inputs
Business Logic
- Also called “Service” Layer
- Where your code needs to execute for your specific business processes
Data Access
- Also called “Domain” Layer
- In Salesforce environment
- Triggers, Trigger Handlers, and default logic that exists for a given object
- This is the one that I’m most confused by…
Database
- Also called “Selector” Layer
- Code that makes it easy to select certain data from different database tables