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

Unity - Using Event Manager type class for decoupling

I've been trying to use events to decouple components wherever possible, and recently started reading more about "Event Manager" classes. The implementations I've been seeing however are solving one problem about decoupling but creating another. Let…
1
vote
1 answer

How to pass config setting in Django and keep module decoupled?

In a Python Django project, I have a module with a class (let's say SomeDataStore) that abstracts file storage behaviour and requires a config setting with the correct path (different for development, prod, ...) Currently, I've done it like this: #…
Rabarberski
  • 23,854
  • 21
  • 74
  • 96
1
vote
1 answer

Register ngRx effect on a "success" action? Or should this be decoupled with a service?

Currently I subscribe a ngRx effect on a "success" action (assuming my action is loadDataSuccess)? createEffect(() => { return this.actions$.pipe( ofType(loadDataSuccess), ... It somehow stings in my head, that this is bad practice. Is…
Herr Derb
  • 4,977
  • 5
  • 34
  • 62
1
vote
0 answers

How do you pythonically reuse a complex data structure without copying or re-reading a file?

I'm writing a Discord bot that, among many other things, must engage in question-answer dialogues with users. There may be multiple of the same kind of dialogue ("script") running at once asynchronously. On program startup, a YAML file is read which…
Wookieguy
  • 231
  • 1
  • 4
  • 11
1
vote
2 answers

how to properly decouple implementation specifics into class libraries in .net

I'm wondering if there is a standard way in c#(or maybe even cli) to efficiently decouple implementation logic into separate class libraries/assemblies that would be dynamically loaded by a process that will preforms actions on those libraries based…
Dmitry
  • 1,513
  • 1
  • 15
  • 33
1
vote
0 answers

What design pattern should I use? Different classes, same static behaviour

I'm working on an RPG videogame. As you do in most RPGs, if you want a clean interface, you try to highlight certain bits of text when it is especially relevant to the player. For instance, every time I want to say "this attack deals 30 cold damage"…
1
vote
1 answer

How to decouple mode switching and commands

How to decouple a Mode (normally expressed by enums) from its implementation in commands and their relationship? Is their a good pattern describing the loose binding between a mode switch (int, enum, string, ...) and its command calls? I want to add…
Beachwalker
  • 7,685
  • 6
  • 52
  • 94
1
vote
0 answers

MakerDAO vs AAVE solidity architecture design

I have an interesting solidity architecture question. I noticed that the DAI contracts makerdao are using only 'interface' style to communicate between contracts, avoiding absolutely using the 'import' keyword. From the other point of view, aave…
Henry H.
  • 901
  • 8
  • 11
1
vote
1 answer

Why new keyword considered as high coupling in Java?

I am working on Java for some time. I saw there are too many talks about decoupling the objects. I see they say "new" keyword is considered as symbol of high coupling. I did not get any answer till now why it is. can anyone explain me?
Swastik
  • 499
  • 1
  • 4
  • 10
1
vote
0 answers

Dealing with command line options in a typesafe manner, after parsing with JOpts

When parsing options with the JOpt Simple library, the only way I know of accessing their respective types is by saving the OptionSpec instances somewhere and accessing them latter. For example: OptionParser parser = new…
Adrubioco
  • 11
  • 1
1
vote
1 answer

the best approach for processing submitted time consuming tasks through REST api in spring boot

I have a spring boot web project which needs to work with a web crawler system. My crawler service works without any downtime and each crawl request maybe have very long time processing. I want to get the URLs for crawl through a REST interface. The…
1
vote
2 answers

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 inverseAndSqrt. What this function actually does is…
1
vote
1 answer

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). The goal is to make the layers as much decoupled as possible. Imagine…
1
vote
1 answer

What does IP_NETWORK and IP_DEVICE in the Decouple Python library mean?

I was reading through the Decouple Python library, but I don't understand what the following code does- IP_NETWORK = config("IP_NETWORK") IP_DEVICE = config("IP_DEVICE") I know that, there has to be a .env file setup, where the IP_NETWORK and…
NotMyName
  • 85
  • 1
  • 11
1
vote
1 answer

Coupled Poisson equations and Matlab program

can anyone help me solve it? Or help me uncouple the equations? :( $u_{xx}+u_{yy}=au+bw$ $w_{xx}+w_{yy}=cu+dw$ Also I have to solve this problem using the finite difference method, but once i get the output everything's zero. This is my Matlab code,…
Valentina
  • 13
  • 2