Questions tagged [separation-of-concerns]

Separation of concerns is a design principle.

See also

141 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
  • 3,009
  • 2
  • 19
  • 21
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…
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
  • 6
  • 9
45
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…
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
  • 1
  • 2
  • 7
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,157
  • 5
  • 36
  • 68
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…
14
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
  • 251
  • 2
  • 6
14
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…
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
  • 5
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…
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
  • 5
  • 9
10
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…
10
votes
7 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,157
  • 5
  • 36
  • 68
7
votes
1 answer

Separate object used in business layer, data layer and presentation layer

I'm building an application that is responsible for reading data from files and displaying them in charts. The whole application is responsible for manipulating data from files, which means I have to use different parts of the same object in almost…
FCin
  • 522
  • 7
  • 22
1
2 3
9 10