Questions tagged [separation-of-concerns]

Separation of concerns is a design principle.

Filter by
Sorted by
Tagged with
0 votes
1 answer
96 views

Validation logic dependencies and separation of concerns

I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, ...
2 votes
3 answers
134 views

Where to specify UI views in a hierarchy of model objects?

In a Flutter app I'm developing, I have a class hierarchy of model objects of a certain base class. To take a typical example, the abstract base class could be Vehicle. Then I have a (pretty much) ...
1 vote
4 answers
381 views

Is there any intent behind SRP other than SoC

Edit based on responses so far I am starting with an edit so as to save future contributors from going down the same path others have. I am only interested in contributions that stick to the exact ...
0 votes
1 answer
231 views

How to deal with overlapping domains?

I'm a Java developer and I'm try to separate my code to packages (modules, services, whatever the chosen unit of functionality is). Let's say I'm creating a system that tracks employees and the ...
1 vote
4 answers
1k views

Why are async/await allowed inside the domain model of DDD?

I am trying to challenge my understanding of DDD by pushing it to the extreme. My question is not about a specific practical use case. Rather my question is an abstract one related to DDD in general. ...
56 votes
11 answers
4k views

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 ...
11 votes
7 answers
3k views

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, ...
0 votes
2 answers
749 views

How to separate UI and business logic when they are intertwined by design

I am refactoring a legacy codebase of an Angular SPA. The central entity of the app is the chat room, and there is a plethora of ways on how to enter a chat from different views all across the app. ...
2 votes
2 answers
239 views

To maintain SOLID, should data preparation, conversion, and pre-computation for purposes of saving an object, be separate from data persistence layer?

I am facing a common situation where I am saving some values into database from a business object. I am using a relational database and usually I only need to save a few items that are part of the ...
2 votes
3 answers
268 views

how to leverage overloading while keeping business logic out of models

I am running into a conflict between two best practice principles- overloading should be used instead of long chained if/else statements models should not contain business logic I am working on a ...
-3 votes
1 answer
125 views

Using two different languages where one would suffice for the task (microservices)

I previously asked this on StackOverflow, but doesn't fit there and I was suggested to move it here. I was thinking about using two seperate backend languages for seperating concerns in a project of ...
0 votes
1 answer
377 views

Blazor Application separation of concerns

I am building a cross-platform application and have planned to use Blazor. I have made similar applications in the past but using ASP.Net Core for the back-end and Angular for the front-end. I always ...
1 vote
2 answers
2k views

Making data available for multiple microservices

We have a design challenge here for a project we are working on and I wonder if folks from the community can provide some guidance: Our product is built in a microservices structure. So we have ...
2 votes
3 answers
761 views

How do you achieve encapsulation while "separating view and business logic"?

I've been trying to get a better understanding of OOP (I'm not the biggest fan of it, but I still want to understand it). One of the core principles of OOP is encapsulation - you're supposed to ...
0 votes
1 answer
255 views

Designing functions with separation of concern in mind

Is there a name related to the pattern shown in the code that follows? Or is there writing/thinking on the [design of] code shown that suggests it is an anti-pattern? In general, I'm curious if this ...
2 votes
3 answers
128 views

Should a process be responsible for scheduling itself?

I need to create a very small service which will programmatically make a database insertion once a day. As our stack primarily uses Node.js, we’re going to write a JS script responsible just for ...
51 votes
15 answers
9k views

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 ...
1 vote
2 answers
253 views

Is it a good/bad practice to create overlapping types?

Here's a simple example: an API returns a list of possible options with the following structure: { "familystatus": [ { "Id": 1, "Name": "single&...
2 votes
1 answer
423 views

Separation of concerns

I'm approaching the DDD way and I was posing myself some questions. Assume that I'm writing an application that lets you define a nutritional week, where you can Define a nutritional week as a ...
0 votes
2 answers
949 views

Architecting project into multiple source control repositories

I'm doing some work with my team to refactor/rearchitect some parts of our existing codebase which consists of two separate Django apps hosted in one common project repository. We're starting work on ...
0 votes
1 answer
173 views

Seperation of concerns: Submitting a form to create an email, store it and send it

Context I have a workflow that has an email form. The requirements are the following: A user completes the form that contains email fields and submits it. If everything goes well then an email model ...
-1 votes
1 answer
222 views

New frontend for legacy code

How would you engineer this: You have a legacy application that is a big ball of mud and a monolith. This application is "impossible" to change to look good on mobile devices. The management ...
2 votes
2 answers
146 views

Use old legacy application code from new application

If you have a big legacy application (big ball of mud), lets call it MudApp. If you then create a new application to make us of new technology and to make a new good looking frontend because that was ...
10 votes
6 answers
1k views

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 ...
1 vote
1 answer
528 views

In which layer should I load views on a Clean(ish) architecture?

I am trying to organize my architecture following the clean architecture while using some common practices/frameworks. I'm writing in PHP, but have no problem with other languages. The flow of my app ...
5 votes
2 answers
15k views

How to separate the ViewModel from the Model, yet associate them with each other based on the Model?

In a wpf application, a Model object is created either from scratch or deserialized from some .xml file. To create a connection to the ViewModel, the following method (on the Model!) is used by the ...
0 votes
0 answers
42 views

Using a bulletin board to support Separation Of Concerns

Context: I'm working on an embedded system with many small functional modules. The business logic within each module is made as simple as possible, but those modules generally need to gather bits of ...
1 vote
2 answers
172 views

How does one choose where to place logic which converts data between two formats/representations?

Suppose I have two "modules", A, and B (I'm choosing not to use classes, because you generally can't create an instance of a module, which makes this question simpler). These modules contain ...
0 votes
0 answers
610 views

What's a valid use case of JPA annotation @Transient?

I'm new to JPA and Hibernate. I just saw an annotation called @Transient, which can mark a field to be non-persistent in the database. However, for the sake of "separation of concerns" ...
0 votes
0 answers
41 views

Use debug-functionality without breaking architecture

note: This is of couse about software-architecture/design-principles, but as no architecture is completely detached from its language, please note that the language i am using is C++. I am using an ...
-2 votes
3 answers
2k views

Best Practices for Managing SQL Code

I have a issue that keeps coming up as a developer using any .NET (C# mostly) and SQL. I personally feel it is bad practice to build SQL statements in code. There are too many case scenarios that may ...
-2 votes
1 answer
224 views

Understanding Headless CMS architecture from an engineering (rather than a user) perspective

TLDR: In a Headless CMS (or a Decoupled CMS), the content retrieved by the front-end needs to be identifiable (somehow). This is where I'm stuck. I can describe my guesses of how platform-agnostic ...
45 votes
6 answers
16k views

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 ...
6 votes
6 answers
2k views

Why Have People Started Deeming it Necessary to Separate JS hooks from CSS hooks in HTML?

Edit: Point of clarificatioon, IDs and classes as separate hooks is just one form of the applied idea in question which is to never use the same hooks for CSS as you do in JS. I've also seen people ...
2 votes
1 answer
119 views

Separating Plotting and Computation Logic in Scientific Computing MVC App

I’m developing a Matlab GUI for a scientific computing application and need to plot fairly heavy intermediate results. Currently, the computation is represented as a function. The GUI accepts user ...
1 vote
1 answer
430 views

Include Get Password function in User Domain without violating separation of concerns

Problem: I am using a Domain Driven Design architecture and I have a domain model called User as follows: public class User{ public User(string username){ this.Username = username; } ...
1 vote
2 answers
3k views

How to Validate a Child Object Based on Parent Object's Data

Taking into consideration that I'm making an attempt at Domain-Driven Design and overall good separation of concerns when it comes to business logic, data access logic, etc... Question: How do you ...
57 votes
5 answers
44k views

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?
0 votes
3 answers
514 views

Do higher order functions violate the separation of data and code principle?

I am asking here something that is really haunting for years (for real !). I guess in a "perfect world", we would have programs made of data models and functions, and those functions manipulate data ...
3 votes
3 answers
257 views

Is this a good method of separation?

I am creating a web application that is tiered in the following way: Controller > Service > Repository I have a ProductsController which has the following action: [ValidateModel] [HttpPost] public ...
2 votes
2 answers
220 views

What is wrong with writing web applications in a way that merges repository layer with view and with controller in the same file?

is there anything wrong with writing code in a way that merges view, repository, controller in the same file? i.e. global $db; // or $db = DBSingleton::get_db_instance(); // or global $container; $...
0 votes
1 answer
2k views

Simplest Architecture to separate UI and business logic on Windows

I guess the goal of separating UI and business logic goes way back. I found a Martin Fowler article, from nearly 20 years ago, which is pretty clear about the benefits of the separation: https://www....
2 votes
1 answer
4k views

Separate presentation layer from data entities

I am building a software where UI, Business Layer and Data Access Layer are tightly coupled in a single tier. I want to decouple layers, because a change in the database can cause the change in my ...
1 vote
2 answers
337 views

Reuse domain entity logic

Usually the domain logic should be contained in the domain entity, rather than being put in specialised external classes called from the entity. This is good to prevent that somebody comes later, ...
11 votes
7 answers
4k views

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" ...
0 votes
1 answer
112 views

Separation of Logic and UI - Does the orchestration belong in the model?

I wrote an app with the MVP Passive View pattern. My solution has four different projects. A MyApp.Core containing all kind of business logic, a MyApp.Forms containing stuff related to WinForms (UI), ...
2 votes
1 answer
124 views

Put functionality in same executable with command-line flag, or put it in a separate executable?

Background: I am working on a service where the domain logic exists as a library, and then the actual executable is built on a web framework as a wrapper around the domain logic library. There is no ...
0 votes
1 answer
138 views

Separation of concerns SOAP Services

I'm having a discussion in my company on how to structure a student enrollment application we are doing. We have an SOAP-Service for sending Emails. This Service is in charge of sending, and logging ...
-1 votes
2 answers
164 views

How to choose the most suitable solution for a problem given some choices?

To ilustrate my main concern let's start by considering a "trivial" typical problem, data filtering & parsing coming from a process and dumping the information onto something {gui console, file, ...
5 votes
4 answers
7k views

Separation of application logic and domain logic in Clean Architecture

I'm struggling with the separation of logic between entities and interactors or Use Cases. If I design the entities with DDD principles, each entity would have methods corresponding to use cases, ...