Questions tagged [separation-of-concerns]
Design principle that comprises the process of separating a computer program into distinct features that overlap in functionality as little as possible.
486
questions
0
votes
0
answers
16
views
Next.js static site - how to separate code and content (including static files) into two projects
I have a static blog built using next.js and hosted by vercel.
I would like separate the code and the blog content (markdown files, images, etc) into different repos and make the content repo a ...
1
vote
2
answers
81
views
Dependency inversion in python - why is it used? Can't see the benefit
I've been trying to understand dependency inversion in python. I understand the theory that everybody quotes but I've not yet seen the code example with and without inversion that would clearly ...
0
votes
0
answers
46
views
Separation of concern in React with event listeners that cause component rendering?
I have been reading about how it is a good idea to separate your "buiness logic" from your "view" when designing apps and it makes perfect sense. However, I was thinking about how ...
1
vote
2
answers
63
views
Decoupling auth module in microservices
We started working on a project recently where we had to build functionality around auth and users. We decided on dividing the responsibilities as :
User service
keeping user entity
user related crud ...
1
vote
1
answer
155
views
MAUI+ASP.NET DTOs
I have a project consisting of 2 parts:
ASP.NET API using Entity Framework
.NET MAUI Client App
I use DTOs for comunication from/to the API in order not to expose other properties of my entities. ...
0
votes
2
answers
35
views
Feature envy, encapsulation, active record, separation of concerns? When its bad?
you all say, object oriented programming is about encapsulation, data hiding. Let's given this example:
class Rectangle
{
private int a,b;
public function __construct(int a, int b)
{
...
3
votes
2
answers
83
views
Dynamic concerns with inheritance not loading twice, but only once
We are loading code dynamically with concerns, based on some environment variables, which works pretty nice.
Something like this:
# User class
class User
include DynamicConcern
end
module ...
0
votes
1
answer
375
views
How to apply Clean Architecture when my data source is coming from a BluetoothLE Bound Service?
I have been developing this Android app for some time and have realized that my Activities are way too bloated so I have been trying to switch to MVVM with Clean Architecture but am running into an ...
0
votes
1
answer
653
views
vue3 template separation and script setup
I am currently migrating a Vue2 Project to Vue3. With Vue2 I've always had my component parts split up in separate files. I.e. the component's Vue template loads from different source files like this:
...
5
votes
2
answers
204
views
Django - adding gamification features
I have a medium size Django REST app that I'm looking to add gamification features to.
The application in question is a school webapp where students can create mockup quizzes, participate in exams ...
0
votes
0
answers
22
views
What is the overhead of having many projects in solution
Scenario:
Let's say I have a project, that I would like to split to 3 subdomains and each to 3 layers.
That's 9 project instead of one, but the overall amount of code does not change.
Question
Can you ...
3
votes
1
answer
138
views
How should library crates be designed around Rust's Orphan Rule?
My understanding of the orphan rule of interest is that:
For any impl of a Trait on a Type, either the Trait or the Type must be defined in the same crate as the impl.
or equivalently:
It is ...
0
votes
1
answer
310
views
Seperating Repository and Service Layer
I am working on an ASP.NET Core Web API project using EF core and would like to add Repository and Service Layers to my application to achieve Separation of Concerns.
However, I still can not figure ...
0
votes
0
answers
56
views
Flutter+BloC+DevicePreview : Is it possible for the simulation of the app to provide a substitue BloC?
Our situation is like this: We have an app and an admin panel. Inside the admin panel we present a simulation of the app, made with device_preview package. State management of the app has been ...
1
vote
0
answers
267
views
how to separate business logic from prisma logic
I have just started using Prisma as an orm, in my project, but I am not sure how to separate the Prisma queries and logic code from the service logic that's using Prisma, since we can't use the ...
4
votes
0
answers
877
views
CLEAN ARCHITECTURE REACT
I am at the beginning of an enterprise level application with 2 years of developing in front of me, and I was wondering how to organize my code while having in mind that the project will be huge and ...
0
votes
1
answer
191
views
Proper separation of concerns between microservices
Let's assume I would like to create a blogging platform that would allow managing user accounts, therefore I came up with 2 microservices:
Blogging - managing posts, tags, etc.
Users - managing users,...
0
votes
0
answers
75
views
In an MVC design, how should the Model communicate with the View?
Edit TL;DR: I have an MVC application that has a Controller which is aware of the Model and the View, but the View and Model do not have any references to each other and the Model does not have a ...
5
votes
1
answer
107
views
Is it acceptable for a reducer to mutate its action object in order to communicate partial handling of the action?
I’m writing a pretty complex app in React/Redux/Redux Toolkit, and I came across a situation which I’m not really sure how to handle. I found a way to do it, but I’m wondering if it can cause issues ...
0
votes
1
answer
122
views
Seperation of concerns (service and router layer)
I would like to improve my skills in Node JS. Right now I'm interested in how to cleanly separate the service and router layers of an application so I can avoid something like code duplication.
The ...
0
votes
1
answer
280
views
Android: MVVM and separation of concerns
I'm almost finishing migrating my app to MVVM with databinding and livedata (still java though) and now I have much more than a decent architectured Android app (which I'm showing below). I'm happy ...
0
votes
0
answers
58
views
How to split changes in multiple linked working trees?
On my local repo I have the main working tree full of many unrelated changes.
I want to split my messy index into many distinct tidy linked worktrees, so I can isolate changes by concern and handle ...
1
vote
0
answers
154
views
Stencil.js - Separate concerns between UI & Logic
This question is inspired by the convention of Using React Hooks to Separate Concerns.
Would it be possible to incorporate a similar system using Stencil?
This is the initial idea, it is inspired by ...
39
votes
3
answers
18k
views
Reactjs separation of UI and business logic
I am new to react and I find it sore in the eyes to look at the component flooded with lots of functions and variable initializations together with the UI. Is it possible to separate them?
Instead of ...
1
vote
1
answer
133
views
How do I use a JDBC Swing Worker with connection pooling (ideally while separating SQL and application logic)?
I have a Java application with a Swing GUI that uses a swing worker to pull data out of a database (e.g., SQLite or MySQL) to fill a JTable. The swing worker uses JDBC and puts chunks of rows at a ...
0
votes
1
answer
358
views
Is there a way to split HTML document into two files, structure and content?
As far as I know, it is considered a good practice in program development to move the strings to the separate files. It allows translators and copyrighters to easily work with them, without needing to ...
1
vote
1
answer
599
views
What exactly is the Aggregate in Event Sourcing?
I really like the concept of event sourcing. To replay specific events to calculate a domain model state is just wonderful.
When i read into Event Sourcing, i am still confused by the term "...
0
votes
1
answer
153
views
Design pattern for separation of concerns
I've am looking for a design pattern to provide separation of concerns and keep the my operations segregated.
In my application I'm getting say 1000 requests, which needs to perform one of 3 given ...
0
votes
0
answers
66
views
How to write php script to render html to another fille?
I have another php newbie question:
I writing a CRUD web app. I have a php file that will fetch data from database and saves the results as variables. Based on search results its rendering some html.
/...
1
vote
2
answers
334
views
Where to write UI logic in an Angular app?
Assume I have an Angular app with two views. The first view shows a preview of some object, let's say a car, and the other view shows detailed information of that car. The car model would be something ...
1
vote
0
answers
30
views
Selecting different graphics for the view depending on model type
Introduction
I'm building a relatively simple program to design layouts on a perfboard (simple diy-friendly circuit board). I'm using WinForms's System.Drawing to draw the circuit board. I need to be ...
0
votes
1
answer
63
views
Balancing separation of concerns, implementation hiding and data transfer objects
Implementation hiding demands us to hide the internal structure of a class from the user. Let's state for the sake of simplicity: reduce the number of getters/setters to a minimum.
Separation of ...
0
votes
1
answer
40
views
Separation of concerns for a API or Service accepting query filters
I always had this confusion which I couldn't reason more. Every time I think about it I go confused.
It is also hard to put in one line that's why the title is ambiguous.
All it is about where logic ...
1
vote
1
answer
780
views
Angular - is it good practice using output event emitters directly in the template?
Normally in Angular I am used to treating html events that lead to component output firing in the manner like in the example:
//component:
@Output()
imageHoverEnter = new EventEmitter<void>();
...
0
votes
0
answers
242
views
How to handle Authorization token expiring at the configuration level
One way of adding an authorization token to your HttpRequestMessage is to simply add it at the configuration level:
services.AddHttpClient<INetworkService, NetworkService>(client =>
{
...
0
votes
1
answer
318
views
Struct Factories in Solidity
So I am working on a DApp in Solidity and would like to make use of Separation of Concerns. I have a Contract that adds and removes Users. My Users are of type Struct. So I thought I would write ...
1
vote
2
answers
276
views
Writing modules in Haskell the right way
(I'm totally rewriting this question to give it a better focus; you can see the history of changes if you want to see the original.)
Let's say I have two modules:
One module defines the function ...
0
votes
1
answer
189
views
How to separate logic from data access while maintaining application level concurrency in database
I am trying to reserve orders for an item. But to do that, I need to be able to fetch the items and lock them so that other concurrent reads and writes are blocked till I update or release the lock. ...
4
votes
1
answer
426
views
Implementing Applicative instance for dictionaries (Map, associated arrays)
It seems straightforward to implement a functor instance (essentially a mapping operation) for associated arrays (e.g. see Functor definition [1]). However, Applicative instance is not defined. Is ...
1
vote
1
answer
140
views
Does it considered as a good practice to write interfaces in a higher layer?
I was thinking that would be better to write on the "Application" layer (Business) the interfaces of the unit of work, and their implementations on the "Persistence" layer (DAL). ...
5
votes
1
answer
584
views
How to setup resources dependencies in alt:V
I have seen that it is possible to have dependencies between multiple resources. So that resource1 uses functionality of resource2. How does the communication between resources work?
When should I ...
1
vote
1
answer
209
views
redux-thunk and in app architecture - want to render only views in views and dispatch GET actions in separate component
I am using react-redux and redux-thunk in my application and there are two things I am trying to do:
I want to be able to share the results of a GET request in two components. I know you can do this ...
1
vote
2
answers
198
views
JavaScript classes, how does one apply "Separation of Concerns" and "Don't repeat Yourself" (DRY) in practice
I'm just in the process of learning how JavaScript classes work and I'm just looking for some advice on how to achieve something quite simple I hope regarding animating some elements.
I have created ...
1
vote
1
answer
30
views
How to separate concerns between a players cash and its manipulation?
In a very small game I am writing a player has some cash (which is just an Int), but I don't want to directly manipulate the cash in the player class; I feel the player class shouldn't care about cash ...
2
votes
0
answers
94
views
How to enforce code contract on a Pony Entity
I am aiming at separating concerns using layered architecture in my design. In order to achieve that I define core object properties using Abstract Base Classes (ABC), eg.:
from abc import ABC, ...
4
votes
1
answer
637
views
Is it possible to split up WORKSPACE file in several files?
I have a Bazel project with a WORKSPACE and many packages. WORKSPACE file is quite huge, so I wonder if it's possible to break it down in separated files and import them.
0
votes
0
answers
186
views
Express authorization middlewares; when the role is not enough
I'm working with Node, and Express to handle requests. JWT-based authentication and role-based authorization.
So, every time I find an article or tutorial online about Express authorization ...
2
votes
1
answer
34
views
Mozilla Extensions: Variable Scopes
AFAIK, all top-level variables in content scripts must be globally unique within the window. So if two content scripts both include a line like let port = ...;, they will break the extension. This ...
1
vote
0
answers
26
views
Code-Design : Can I write the code to update the last modified date of the entity inside the method that persists an entity?
Let's say I have an entity:
Employee {
_id,
name,
lastModifiedTimeStamp
}
and a method to persist it . This persist method can be called from anywhere.
boolean persist(Employee e ){
....
&...
0
votes
1
answer
783
views
a way to point one bean to another in spring xml
Is there a way to point one bean to another using Spring XML SPring Expression Language (SPEL), other than aliasing? string4 below works using aliasing. But string3 does not. string3 is not working ...