Questions tagged [decoupling]

Decoupling is the reduction of dependencies between computational parts.

Coupling is a measure of dependencies between different parts of a computer program.

Decoupling is the reduction of said dependencies, in order to improve code maintainability.

The goal of decoupling is to create a loosely coupled program (also known as "low/weak coupling".

That is because a high/tight/strong coupling program is harder to change since often a change in one part of the code forces changes to other parts of the code as well, causing a ripple effect that can spread throughout the entire code base in worst case scenarios.

The benefit of a a low/loose/weak coupling program is that when a change is needed in one part of the code, it should require no change (or at the very least, as little change as possible) to the other parts of the program - thus making the maintenance of a loosely coupled program easier.

370 questions
1
vote
1 answer

Is there a way to keep undesirialized json fields after desrialization and reserialization

We are implementing a microservices based system. In order to keep loose coupling as possible, the system is event driven, meanning based on kafka pubsub mechanism. Now, some of the microservices are written in java spring so the messages are…
1
vote
1 answer

Transform Webservice Request into internal representation?

I am implementing a SOAP-Webservice which receives different Requests. Should my Manager-class transform this Request objects into an internal representation before delegating them to implementation classes? I think this would be a good idea…
Kai
  • 38,985
  • 14
  • 88
  • 103
1
vote
0 answers

How to detect sibbling subpackage imports to test architectural coupling rules

Project directory structure: I've got a Python 3 project with following directory structure (a src package and test outside source package): root/ ├── readme.md ├── setup.py ├── setup.cfg ├── src │ ├── common │ │ ├── __init__.py │ │ └──…
1
vote
1 answer

Microservices, How to decouple services if data on one service depends on other?

Lets say that I have two microservices, which looks like this: I have one service that stores all questions and their answer options. The second service creates modules that will use questions from first service. So we have Question Service and…
Mr.D
  • 7,353
  • 13
  • 60
  • 119
1
vote
1 answer

How to execute a long task in background?

I have an app made using Symfony 5, and I have a script that upload a video located on the server to the logged-in user channel. Here's basically the code of my controller: /** * Upload a video to YouTube. * *…
ThibaultV
  • 529
  • 1
  • 5
  • 24
1
vote
0 answers

Strong Coupling between DAOClasses, getting references result in StackOverflow

I've been dealing with DAOClasses and I've come accross a serious problem which forces me to reorganize my entire project. However I have no clue on how to solve this problem. Suppose I have 3 Entities: public class User { private int id; …
King Powa
  • 441
  • 3
  • 9
1
vote
1 answer

How to avoid transitive type dependencies?

I am trying to learn more about structuring software with type parameters and traits. I can make my program work, I am just trying to improve decoupling. When I depend on a type that has a type parameter, say A, where the type parameter has a…
1
vote
4 answers

Low coupling and SQL joins

Say I have a table people (id, firstname, lastname). There are two other tables that should contain these fields, so we'll just reuse the people table: users (id, username, person_id) and companies (id, name, contact_person_id). Now to get companies…
Markus Hedlund
  • 23,374
  • 22
  • 80
  • 109
1
vote
1 answer

Prism - Unity equivalent of MEF functionality?

I have a solution structured like so: Models assembly Data assembly - defines repository interfaces and a base repository class ORM assembly - implements repository interfaces & inherits base repository class ^ Business assembly - has a…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
1
vote
1 answer

How to decide whether one class is a cohesive part vs dependency of another class (In terms of unit testing)?

I'm working on a project that was not designed with unit testing in mind. Since inside of StartWorking() method I create a new instance of WorkYear and call year.RecalculateAllTime(), is WorkYear class considered to be an external dependency (in…
1
vote
1 answer

How interface comes in and decouples two tightly coupled methods?

I have this following codes, to help me explain what I have trouble with the decoupling concept. for example; async getSomething(id: number): Promise { if(id === "111") { return true; } else { return false; } } someFunc(): void { …
roger
  • 1,225
  • 2
  • 17
  • 33
1
vote
1 answer

Is completely mocking the back-end logic for the front-end reasonable?

My boss asked me to find a way to completely disassociate our front-end application from the back-end in the local environment, currently I'm the sole developer for both our back-end software and the front-end, so using Docker I'm able to mimic a…
1
vote
2 answers

Repository and Data Mapper Coupling

I have a controller that acquires data to pass to a view. Into this is injected (via a pimple container) a service which uses a number of domain models + business logic to create the data. The service itself has a 'repository' class injected into…
1
vote
1 answer

Stamp Coupling Improvement

I study programming in my college Stamp Coupling. We are learning system analysis and design. My classmate ask me the question, how to solve Stamp Coupling? I ask Teacher who said "Use an interface to limit access from clients", but I still…
LiHao
  • 290
  • 3
  • 13
1
vote
0 answers

There are coupled or decoupled bundles?

The documentation of Define Relationships with Abstract Classes and Interfaces said: With the **ResolveTargetEntityListener**, you are able to decouple your bundles, keeping them usable by themselves, but still being able to define…
Mohamed Ben HEnda
  • 2,686
  • 1
  • 30
  • 44