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

Decoupling the database CODE for real

Im in a project creating a web application. Writing in php5. As I was creating the user system (login, register new users and stuff) I all of a sudden had database code all over the place. Dont get me wrong, Im using a singleton database class with…
jelgh
  • 705
  • 1
  • 6
  • 22
2
votes
1 answer

Bus and REST services with fast response for decoupling?

Having several backend modules exposing a REST API, one of the module needs to call other modules through their API and have an immediate response. A solution is to directly call the REST API from this 'top' module. The problem is that it creates…
unludo
  • 4,912
  • 7
  • 47
  • 71
2
votes
1 answer

Backbone.js is it ok to call a method on a view in the add handler of a collection?

I have a collection in backbone... in the initialize method I'm doing this.... I want to rerender a view when this collection has an item added to it. initialize: function (models, options) { this.bind('add', function () { …
Hcabnettek
  • 12,678
  • 38
  • 124
  • 190
2
votes
2 answers

Backbone.js - decoupling a data source?

I have this Backbone model: graphModel attributes country indicator year With a corresponding view: graphView render() this.model.get(...) The application also has a general datasource to which csv data is loaded: dataSource …
dani
  • 4,880
  • 8
  • 55
  • 95
2
votes
3 answers

Seeking recommendations on how to decouple JS code from views

JavaScript plays an increasingly important role in most web solutions, but I find that it is much harder to decouple the JS code from the view specifics than it is for the server-side code. What techniques are people using to decouple the JS code,…
Morten Mertner
  • 9,414
  • 4
  • 39
  • 56
2
votes
1 answer

Entity Framework and coupling

I had a little discussion with a friend of mine about the use of Entity framework. I had a project where I made a 3 tier solution with the entity framework as my datalayer, and used Data Transfer Objects to move from the business tier to user…
Dofs
  • 17,737
  • 28
  • 75
  • 123
2
votes
2 answers

State pattern: Which class should I trust to update the state?

I am learning design pattern by reading Head First Design Patterns, and I have just finished the chapter on the State Pattern. However, there is one thing I don't get: In the book, the class which has a state is called the Context, while the actual…
zw324
  • 26,764
  • 16
  • 85
  • 118
2
votes
2 answers

Consuming an External API that has a complex filter syntax

I need to List/Get/Update/Create/Destroy (ie perform CRUD activites) on data from an external REST API. This API has a custom filter syntax, which looks like…
2
votes
4 answers

How to further decouple this WPF example toward MVC, MVP, or MVVM?

I've decoupled events in this WPF application in the following way. What is the best way to continue decoupling? Shell.xaml:
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
2
votes
1 answer

How to decouple this transitive dependency

I'm trying to figure out how to remove a transitive dependency from my service. Let's call my service ServiceA. ServiceA depends on LibraryB. LibraryB depends on LibraryC. Therefor ServiceA transitively depends on LibraryC. Let me explain how... In…
HairOfTheDog
  • 2,489
  • 2
  • 29
  • 35
2
votes
2 answers

In settings.py, how should environment variables be loaded/set if they're only used in one environment?

I have a Django application where I'm handling environment variables using python-decouple and separate .env files. This works fine for variables that exist in both development and production environments, such as DEBUG. SECRET_KEY =…
2
votes
1 answer

Object lifetime related; Does a term/pattern/whatnot exist for the following problem?

I'm trying to write a callback class for my GUI windows. To (hopefully) achieve that, I'm using delegates. typedef srutil::delegate2 CallbackMethod; typedef std::map>…
Erius
  • 1,021
  • 8
  • 21
2
votes
6 answers

C++ - Identifying a family of polymorphic classes without introducing tight coupling

Suppose I have an abstract base class called Component, which is the root of a hierarchy of GUI components. In such a case, we might have two subclasses, Button and Label, both of which are also abstract classes and exist as the root of their own…
Shaun
  • 2,490
  • 6
  • 30
  • 39
2
votes
1 answer

Decouple application service from IFormFile

How to decouple application service from IFormFile without stream copy overhead in asp.net core. public interface IUploadService { Task UploadAsync(IFormFile file, CancellationToken cancellationToken = default); } …
2
votes
1 answer

Using ZeroMQ in a crossplatform desktop/mobile app-suite for architecture concerns

I need to make an architecture decision on a cross-platform app-suite. I basically want to try new way of decoupling modules and implement network I/O using ZeroMQ, knowing it's a message queue for in-process, inter-process and networking…
kakyo
  • 10,460
  • 14
  • 76
  • 140