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
2
votes
3 answers

Why isn't a database considered a form of global state?

I have a general gut feeling about the difference but I'm unable to pinpoint exactly what makes a database different from global state. With a naive definition of "global state", a database is generally at least application-global. You could…
Davy8
  • 30,868
  • 25
  • 115
  • 173
2
votes
1 answer

IoC and managing interfaces

Say I had a business object library which was using IoC to implement a data access library. Where should I define the Data Access Interface? Which library does it belong? Or should it be in a separate library just for interfaces?
g.foley
  • 2,152
  • 3
  • 19
  • 27
2
votes
0 answers

Django model decoupling

I'm working with Django 2.1 on a fairly simple application and I'm struggling to find a pattern I'm convinced with when dealing with app decoupling. Right now I have a simple sales app and a taxes app. The taxes app references the Customer model in…
Agus
  • 33
  • 6
2
votes
2 answers

Microservices (Application-Level joins) more API calls - leads to more latency?

I have 2 Micro Services one for Orders and one for Customers Exactly like below example http://microservices.io/patterns/data/database-per-service.html Which works without any problem. I can list Customers data and Orders data based on input…
Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
2
votes
2 answers

Business logic and rules - how to decouple them from the domain model

I'm having slight trouble figuring out how to make my design loosely coupled. Specifically how to implement business logic and rules into domain models, as well as where to place the different parts of the code - i.e. folder structure. To clarify…
2
votes
1 answer

OOP - Avoiding Coupling When Writing a Game

This is my first question on Stack Overflow, so please forgive me for any poor practices in my question-asking (though I do appreciate feedback to make me better at it.) I'm currently working on a personal project: a 2D strategy game with minimal…
Rayhawk11
  • 41
  • 4
2
votes
1 answer

How can i decouple this project

I have a scenario where my business layer has a direct reference in the form of a dll to my database layer which is acting as the repository in this project, now this means there is a direct dependancy on the database layer which would need…
2
votes
7 answers

How to resolve specific circular dependency: DAL & Logging

Some "high risk" data operations need to be logged. In this case, the "high risk" operations are defined as writes to our ERP system. It happens that we are logging those events to our SQL Server database. Pseudo-code: Public Class…
Larsenal
  • 49,878
  • 43
  • 152
  • 220
2
votes
1 answer

Alternative to SQLAlchemy ORM reconstructor

I am currently working on a little application in Python (3.6) able to handle portfolios of stocks, and to do some financial analysis on it. The functionalities are simply a CRUD interface (Create, Read, Update, Delete) for my portfolios and stocks.…
Edouard Berthe
  • 1,393
  • 2
  • 18
  • 38
2
votes
1 answer

Should I hide generated classes behind a layer?

I have several classes that were generated from a WSDL and I need to write 2 small applications that read some input data, call the webservice and write the responses. Right now I created a bunch of very simple wrapper classes that take the data…
cringe
  • 13,401
  • 15
  • 69
  • 102
2
votes
1 answer

Is a class with only one function cohesive enough?

In his post SOLID: the next step is Functional, Mark Seemann states: If you keep driving your design towards smaller and smaller interfaces, you'll eventually arrive at the ultimate Role Interface: an interface with a single method [...] If you…
2
votes
0 answers

Working with decoupled modules/objects in JavaScript

My understanding of object oriented programming and modular project structures in JS is that it's best practice to decouple objects/modules as much as possible. For example say I have the following two decoupled modules: // person.js module.exports…
McShaman
  • 3,627
  • 8
  • 33
  • 46
2
votes
0 answers

How to decouple code using shared information

Hopefully, I'm not asking a duplicate. I tried searching and didn't find anything, but it could have been my keyword choice (I can't think of what keywords to use). Frequently, while I am coding, I encounter situations like the following: public…
Hau
  • 443
  • 6
  • 13
2
votes
1 answer

Will decoupling be beneficial in a redesign of a legacy application?

I am working on a company running several internet shops. We are about completely rewrite the whole code: site content and products management, order processing, partner relations, accounting, customer base and other. Currently we have a system,…
user184110
2
votes
4 answers

Best place to start decoupling objects

This is a C# question, but really could be language-agnostic I have inherited a large object model (100+ types), with a hierarchy of objects that 'own' 0..n of other typed objects that all share a base (where there is a 'relatively' strict type…
johnc
  • 39,385
  • 37
  • 101
  • 139