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

Can Angular 2 parse links received from external CMS to be resolved as internal

We are working on a decoupled project with Drupal as our backend and Angular as our front-end. Everything is nearing completion but certain (dynamic, as in created in Drupal) pages require links to different pages of the angular app. For…
3
votes
2 answers

How to decouple an event-driven module?

A little background may be needed, but skip to Problem if you feel confident. Hopefully the summary gets the point across. Summary I have an InputDispatcher which dispatches events (mouse, keyboard, etc...) to a Game object. I want to scale…
Vince
  • 14,470
  • 7
  • 39
  • 84
3
votes
1 answer

Increasing the number of Models on Google App Engine affects performance?

I made a Google App Engine application as a class project in my university. Now I need to optimize it to use it commercially. Nowadays, the code is very slow. It has only few Models with many properties in each. Before rewriting the Models code, I…
fjsj
  • 10,995
  • 11
  • 41
  • 57
3
votes
1 answer

PHP decouple MySql queries from classes

It seems all my classes I create are filled with methods that contain MySql queries. I decided to take a shot at decoupling. Below I have my base class Customer, and my repository class CustomerRepository that's passed to the constructor if needed.…
Naterade
  • 2,635
  • 8
  • 34
  • 54
3
votes
1 answer

Exclude npm module dependency?

In the project that I'm working on, we use the Karma test runner, and karma-phantomjs-launcher to help us run tests using PhantomJS. Recently, we have discovered that the PhantomJS version that gets pulled down as a dependency to…
3
votes
2 answers

Understanding how to decouple

I've been trying to keep coupling down in my code, but I think I may not fully understand it. My basic understanding is that coupling is "how dependent classes are on each other and know about the behavior of each other." I know that dependency…
Eric
  • 2,008
  • 3
  • 18
  • 31
3
votes
2 answers

Book/tutorial that teaches how to make programs that are easy to maintain and are less coupled?

I'm a PHP programmer and I really want to increase the quality of my code and most importantly I want to be better at programming. What book, tutorial or article would you guys suggest that I read that teaches how to make programs that are less…
user295284
  • 369
  • 2
  • 4
  • 16
3
votes
3 answers

What is the best practice to decouple GUI design from server-side development when developing modern web applications?

We are currently developing a few web applications and are letting our designers convert signed off paper prototypes into static web pages. In addition to having hyperlinks between pages the designers have started adding jquery calls to update…
Chris
  • 4,237
  • 6
  • 30
  • 42
3
votes
1 answer

Writing a good interface to de-couple from a particular technology ... what to do about exceptions?

I want to write a Java interface to de-couple from a particular technology , what's the best way of forwarding exceptions. Let's say that the technology I want to de-couple from is Amazon SQS. Amazon SQS is essentially a queue service and I want to…
MadSeb
  • 7,958
  • 21
  • 80
  • 121
3
votes
1 answer

Javascript return enclosing function

I have a simple scenario in which I check if something exists before adding it, if it does, I return the function (hence exiting). I use this pattern many times and I would like to decouple it in another simple function. function onEvent(e){ …
NinGen ShinRa
  • 651
  • 5
  • 16
3
votes
3 answers

Should logging reside within a class who's primary purpose is not logging?

This is more of a theoretical question. Should logging reside within a class who's primary purpose is not logging? Here is a simple interface for anything that will preform a calculation on a number. public interface ICalculation { public int…
3
votes
3 answers

Database good system decoupling point?

We have two systems where system A sends data to system B. It is a requirement that each system can run independently of the other and neither will blow up if the other is down. The question is what is the best way for system A to communicate…
Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
3
votes
2 answers

jQuery $.when() where one of its parameters comes via an asynchronous "Deferred pipe"

One use of jQuery's Deferred system is with the $.when() function. It takes a variable number of Promise's and will do something when they allresolve(or when the firstreject`s.) So if you wanted to operated on two Ajax JSON queries for instance you…
hippietrail
  • 15,848
  • 18
  • 99
  • 158
3
votes
1 answer

How to avoid class coupling when the specs insist on it

I have two coupled classes DhcpServer and SessionManager. I got the following requirements in my specs that led to that coupling: DhcpServer must not issue an IP address lease if SessionManager forbids that (e.g. an error occurred while creating a…
Ihor Kaharlichenko
  • 5,944
  • 1
  • 26
  • 32
3
votes
4 answers

Is it bad practice to echo javascript with php

I have a php application that makes use of a Listener class, which basically just sets up an ajax request with jquery (example below). But for some reason, echoing the javascript just seems inelegant. Is it better practice to build a singleton class…
jerry
  • 2,743
  • 9
  • 41
  • 61