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

Symfony 3.3 - What Is A More Optimal Solution Than Having A Global Mapping Array And Checking Against This Array In Every Function?

Current Functionality Hello, We are building a REST API using Symfony 3.3 and want to be able to output any type of error information (both exceptions and API-specific errors) back to the requester as a JSON response. We have already installed a…
khgm13
  • 63
  • 7
0
votes
1 answer

OTP and Ecto code separation in a modern Phoenix web app

After watching this talk, I understand how to separate the web interface and the OTP application, however how should the OTP app and Ecto code be separated, if at all? Currently I'm writing an OTP app that calls Ecto functions, or wrapper functions…
category
  • 2,113
  • 2
  • 22
  • 46
0
votes
1 answer

Decoupling in Class and in Project other than IoC & Dependency Injection (java)

What other (besides IoC & Dependency Injection) decoupling patterns and practices could be used inside of an object and than between objects (in project). If you could post samples if any in Java that would be awesome. I'm working with spring and…
MatBanik
  • 26,356
  • 39
  • 116
  • 178
0
votes
2 answers

What's a good way to couple and decouple linked classes?

I've got two classes that go together, but at any given time an object of a given class might or might not be partnered with an object of the other class, and the partners might change over the course of the program. I want each object to be able…
0
votes
0 answers

Codeigniter Symlinks to join 2 applications

I currently have two CodeIgniter applications CI1 and CI2 that have different purposes. CI1 - front end (contains view and controllers. Controllers call CI2 via REST) CI2 - back end (contains controllers and model. Performs business logic. Receives…
JianYA
  • 2,750
  • 8
  • 60
  • 136
0
votes
0 answers

Asking user input in business logic after some event

So, I really like the idea of separating business logic with UI code (MVC or MVVM). But let's say that in an application some event happens (in business logic) and it needs user input (dialog) to continue. For example if you have a simulation about…
0
votes
1 answer

JSON and coupling

I'm not sure if I understand coupling correctly. I've been told that if I move my data out into an external data file (like JSON), it reduces coupling overall. (I agree with this.) However, if I were to create an object to hold the data contained…
user341554
  • 569
  • 2
  • 8
  • 16
0
votes
0 answers

Should a model be decoupled from a client (Swift MVC)?

I have a client that returns and sends data to a server. Currently the data that it returns is only composed of types in the Core Library (Foundation). It would be helpful if the client sent back data already converted to my Model classes. Is it a…
3366784
  • 2,423
  • 1
  • 14
  • 27
0
votes
0 answers

Best way to decouple large size class

I have a singleton manager class that have around 4000+ line of code. I have to decouple this class. So i have a way to use extension and protocol to decouple this class, but i would like to know some other way to decoupling. Please suggest if any…
0
votes
1 answer

How can I keep two Maven projects loosely coupled?

I have Maven Project A which depends on Maven Project B. These are maintained by me in a GitHub repository. Project B is a utility project that will be used by many other projects. Project A is an application that makes use of the utilities in…
0
votes
0 answers

How to loosely couple user-defined exceptions?

I have a bunch of entities that I do CRUD on, ex. Car, Boat, Banana, etc. All of these have similar exceptions that I throw when something goes wrong. For example, if I'm trying to retrieve something but it doesn't exist I throw an…
GuitarStrum
  • 713
  • 8
  • 24
0
votes
2 answers

Abstract Factory Design Pattern with generics : where is the additional decoupling?

The problem / question. I am trying to decouple as much as possible implementations and interfaces/abstract classes, in order to be able to switch implementations easily. I learnt that the way to go was dependency injection, but before using a whole…
Antonin
  • 879
  • 2
  • 10
  • 27
0
votes
1 answer

REST services - How to hint clients on how to represent data while maintaining decoupling

For simplicity's sake, let's say we are storing users' personal informations like so (JSON here, but that's not the point): { "name": "John" "age": 35 "sex": "M" } We want to have the UI client to create a form in order to display these…
Johnny
  • 1,063
  • 1
  • 11
  • 23
0
votes
0 answers

C# Entity Framework implementation

From my code below i am trying to use the entity frame work as my ORM of choice. And my choice of implementation is seen in the code below. The problem now is based on the practice of writing loosely coupled code. The class StaffRepository below…
Oaks-view
  • 391
  • 1
  • 15
0
votes
0 answers

Should a class be able to hold an instance of itself?

I am currently busy with a PSR-7 project with responses and requests. Currently we are setting up an application in our index.php by doing something like: $app = new Application(); $app->loadConfiguration( '../config/global.yml', ); // Should…
Stephan-v
  • 19,255
  • 31
  • 115
  • 201