Separation of concerns is a design principle.
Questions tagged [separation-of-concerns]
145 questions
57
votes
5 answers
How do you explain Separation of Concerns to others?
If you had a colleague who didn't understand the benefits of Separation of Concerns, or didn't understand it quite enough to apply consistently in their daily work, how would you explain it to them?
Marcie
- 2,999
56
votes
11 answers
What is meant by, "A user shouldn't decide whether it is an Admin or not. The Privileges or Security system should."
The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was:
user.isAdmin()
This prompted a comment which was repeated several times…
GlenPeterson
- 14,950
51
votes
15 answers
Is there ever a reason to do all an object's work in a constructor?
Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they were outsourced. Now, I have nothing against…
Kane
- 603
46
votes
6 answers
Do stored procedures violate three-tier separation?
Some colleagues of mine have told me that having business logic in stored procedures in the database violates the three-tier separation architecture, since the database belongs to the data layer whereas stored procedures are business logic.
I think…
Tulains Córdova
- 39,570
- 13
- 100
- 156
23
votes
4 answers
If MVC is "Separation of Concerns" then why was Razor Syntax introduced?
My question is related to MVC design pattern and Razor Syntax introduced by Microsoft.
While learning MVC design pattern I was told that the idea is based upon a principle known as Separation of Concerns.
But Razor Syntax allows us to use C# in…
John Strowsky
- 347
19
votes
8 answers
When does one hard-code actual data values into the code as opposed to using a DB?
A long-standing question for me has been: when do I store data (actual values) in a database table, and when do I store them right in the code?
The untold consensus has typically been as such(*):
If it is a single variable or a simple structure, or…
Dennis
- 8,267
- 6
- 38
- 70
15
votes
8 answers
Is it possible to keep logging code completely outside the business logic?
With the help of AOP, I can remove the logging code from my business logic. But I think it can only be used to log simple things (i.e. logging method entry/exit and parameter values).
However, what if I need to log something in my business logic?…
Charlie
- 261
15
votes
2 answers
Domain Services vs. Factories vs. Aggregate Roots
After dealing with DDD for months now, I'm still confused about the general purposes of domain services, factories and aggregate roots in relation to each other, e.g. where they overlap in their responsibility.
Example: I need to 1) create a complex…
Acrotygma
- 371
- 1
- 2
- 8
15
votes
5 answers
Storing in-text metadata in a discrete data structure
I am developing an application which will need to store inline, intext metadata. What I mean by that is the following: let's say we have a long text, and we want to store some metadata connected with a specific word, or sentence of the text.
What…
Sunyatasattva
- 440
11
votes
7 answers
Separation of concerns: When is it "too much" separation?
I really love clean code and I always want to code my code in the best possible way. But there was always one thing, I didn't really understand:
When is it too much of "separation of concerns" regarding methods?
Let's say we have the following…
TheOnionMaster
- 237
11
votes
9 answers
Did Dijkstra intend for code modularization, when he wrote about separation of concerns?
First, I read an excerpt Edsger W. Dijkstra's 1974 paper "On the role of scientific thought":
Let me try to explain to you, what to my taste is characteristic for all intelligent thinking. It is, that one is willing to study in
depth an aspect of…
Dennis
- 8,267
- 6
- 38
- 70
11
votes
2 answers
How to cleanly separate different parts of a software application?
I am designing a new application that deals with a lot of business logic.
To avoid the usual entanglement between different application layers that often sneaks into such systems over time, I want to implement clean separation of concerns right from…
B.M.
- 111
11
votes
3 answers
Architecturally speaking, does a database abstraction layer, such as Microsoft's Entity Framework, void the need for a separate Data Access Layer?
The way it was
For years, I have organized my software solutions as such:
Data Access Layer (DAL) to abstract the business of accessing data
Business Logic Layer (BLL) to apply business rules to data sets, handle authentication, etc.
Utilities…
Matt Cashatt
- 3,325
10
votes
11 answers
Difficulty understanding benefit of Separation of Concerns
One of the motivations for separation of concerns is so a change in one place does not affect the other. I am going to make an argument with my limited understanding. Here is a scenario where I fail to see this benefit.
Suppose there is a method…
EMN
- 485
10
votes
6 answers
Does bootstrap break separation of concerns and defeat the purpose of CSS?
Although I have seen a few Bootstrap sites, I have only just started to look into it seriously and I was quite shocked by what I saw in the HTML - loads of nested divs with multiple classes attached to each.
In the old days before CSS, people used…
Andy
- 687