Questions tagged [separation-of-concerns]

Separation of concerns is a design principle.

Filter by
Sorted by
Tagged with
-2
votes
2answers
150 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 ...
1
vote
1answer
104 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
2answers
83 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 ...
4
votes
3answers
216 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 ...
0
votes
3answers
292 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
3answers
182 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 ...
0
votes
1answer
92 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 ...
2
votes
2answers
207 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
1answer
548 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....
0
votes
2answers
103 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, ...
1
vote
0answers
189 views

decouple business logic from supporting logic

To prevent business-logic functions from being bloated with supporting-logic* of shared concerns (e.g. authentication, authorization, logging, profiling, ingress rate-limiting) many backend frameworks ...
2
votes
1answer
101 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
1answer
100 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 ...
0
votes
1answer
42 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), ...
9
votes
7answers
1k 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" ...
9
votes
6answers
2k 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, ...
-1
votes
2answers
110 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, ...
3
votes
4answers
3k 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, ...
1
vote
1answer
54 views

Rx stream resulting in lots of one-off objects

My domain space is Java + RxJava but I think this applies to any reactive framework I have a stack that looks like the diagram below. Just for examples sake I'm describing a login flow but any UI --&...
0
votes
1answer
45 views

Separation of concern. Accessor methods and data sanitisation.

I have a great deal of 'dirty' data pulled from an API request. Before database insertion, I clean out a lot of line feeds and regex out values such as height and width from item descriptions. ...
0
votes
4answers
680 views

Avoid type checking but preserve separation of concerns

I'm working on an MVVM project and trying to preserve separation of concerns. Our current architecture has an entity framework model and MVVM light view and viewmodel projects. I'm working ViewModel ...
1
vote
1answer
610 views

Making UnitOfWork testable

I'm in the process of refactoring legacy code. Unfortunately it is a WebForms application with very tight coupling and smelly code. Currently access to database is inside models which looks something ...
5
votes
3answers
960 views

Separation of concerns for a “Manager” class

I have a Class that "controls" the current application state, ApplicationStateManager. I have an Enum that lists the possible states for the application enum ApplicationState { Idle, ...
4
votes
2answers
9k 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
1answer
144 views

BLL Layer with physical file path

So I am working on an existing website project that has a BLL layer with some functions that use physical file paths. But now I am creating a console app that will be setup as a windows scheduled ...
0
votes
2answers
146 views

How to Avoid Missed Behaviors when Separating Code from Data

I've come across something that I find decently frustrating while adding new functionality to our large existing code base. Preface We have a variety of classes (ItemA, ItemB, ItemC...) that ...
0
votes
2answers
233 views

Is there a problem when data and logic are not separated?

You can do a lot with Excel. Even without Visual Basic Script. But the data and the logic is in one file, whereas normal programming languages usually have another file (or a database) for the data. ...
1
vote
2answers
2k views

Are service objects necessary in OOP?

I have been using AngularJs since a long time. Me and my team makes heavy use of services for retrieving the remote resources like Users which intern uses $http service so, basically, for each entity, ...
1
vote
1answer
2k 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
0answers
96 views

What is the scope of business logic which should be placed in a stateless session bean?

I'm struggling to wrap my head around sizing business logic placed in stateless session beans. It is important that I have little experience in this topic. In the case I have now, there is a JEE ...
2
votes
1answer
276 views

Where is the best place to convert json to objects?

I have a Data Access Layer that uses a json API. If the structure of the program looks like: Controller | Data Access Layer Is it best to convert the response strings into objects in ...
11
votes
8answers
5k views

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 ...
9
votes
2answers
435 views

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

Using business objects with composite ID from a different module

We have two modules: D and S. S has a Web Service interface, which is being used by D. S's responsibility is managing a domain of objects held in a folder-like structure. So, it contains a method ...
7
votes
1answer
2k views

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 ...
4
votes
3answers
87 views

Valid uses for DEFAULT clause in a table column definition, besides sequence nextvalue()

In a recent question, there's a debate whether or not an arbitrary default value in the definition of a column in a table is considered having business logic in the database. As we know, if an insert ...
3
votes
1answer
173 views

Should a State Machine or Processing Engine be abstracted away from the UI?

I'm working on a suite of micro-services, with a web-based GUI. We are using a 3rd party state machine via REST calls. Sometimes we get/set state from one of our micro-services, while other times we ...
2
votes
3answers
898 views

Should Data Access Layer mirror my Database Configuration?

I am trying to decide how (or whether) my Data Access Layer should deal with existing security and integrity protections on the database. The architect in me says that separation of concerns is a ...
3
votes
4answers
130 views

How to separate the logic of my application into a dependency when it is coupled to the structure of the data?

I am about to start prototyping a 'quiz'-like web application that tests test-scoring methodologies, and I have an interesting architectural question. Each quiz given to a user needs to use a set ...
0
votes
4answers
313 views

Should database tables be separated by concern?

My question is related to when should a database table be broken into multiple tables with relations? However, I have a clearer one-to-one relationship than in that question. If I was designing the ...
3
votes
5answers
761 views

Database transaction and separation of concerns

Apllication structure: Business layer public interface IOrderDataService { void Save(Order order); } public interface IOrderLineDataService { void Save(OrderLine orderLine); } public ...
1
vote
2answers
227 views

Separating save logic from WinForm to make it reusable

I have a Windows Form for creating configs. It has around 50 fields of data, which represent a group of entities, that I need to capture when the user presses the save button. Currently, on the press ...
1
vote
0answers
92 views

How to convince teammates to start separating database queries into one single layer

We are using ORM with bunch of database models and those ORM database queries (and models, of course) - are literally all over application from top to bottom. And when change in model structure ...
1
vote
1answer
234 views

Should composition happen no matter what?

I feel like I should be able to register all my components into the application composition root container no matter what the current state of the environment is, even in the case environment lacks ...
3
votes
2answers
144 views

Proper design for models

I have a class called ReplaceRule this is used by 2 classes DocumentRuleViewModel and SectionRuleViewModel as a List<ReplaceRule> in both Question 1: In my database implementation I have 2 ...
1
vote
3answers
149 views

SOLID principles and generating many objects from a file

The "D" in SOLID stands for dependency inversion. If I have for example, a Blacksmith class that depends on Hammer, I should create my Hammer externally and pass it to Blacksmith, rather than having ...
0
votes
1answer
85 views

Should models be returning data directly to the client, or to the controller instead?

Disclaimer: This is my first time: using node, creating a REST API, and trying out MVC server side. (so, just statistically speaking, I'm probably doing something wrong ¯\_(ツ)_/¯) I'm working on ...
3
votes
3answers
218 views

Why do we separate Data Retrieval from View?

I am seeking a good argument for: Why is it NOT a good idea to embed data retrieval code in my view? Example <tr> <td>Product</td> <td><select name="product"> ...
5
votes
1answer
297 views

Increase code duplication to simplify business rules in views

I am in the process of writing a Ruby on Rails web application for my university's department. For some of our resources in the web application, e.g. Project, are complex with their view layer logic: ...
0
votes
1answer
30 views

How to store the current version of an instance? Store reference to specific instance?

I'm working on a project with has different checklists (questions and answers) associated with an entity (Protocol). There is a business requirement to have these questions be altered in the future ...