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

Updating RLMObject's model without committing

Essentially, I have a UITableView with cells that have a UITextField that corresponds with properties (let's say 10+ properties) within a RLMObject. I only allow the user to edit the fields during Edit Mode (via. disabling user interaction). If the…
mattsap
  • 3,790
  • 1
  • 15
  • 36
2
votes
4 answers

TDD with Web Config

All great stories they always start with those 4 magical words... I have inherited a system... no wait! that isn't right! Anyway with my attempt at humour now passed I have not so much been given more I have to support an existing service. There are…
Luke Duddridge
  • 4,285
  • 35
  • 50
2
votes
1 answer

How to decouple code that generates HTML and does recursive summation in same function?

I came across the following code. It prints out HTML (using partial function of ZF2), while also computing total, for all items, recursively. function gen_items($parentId) { $total = 0; $rows = $this->db->getData($parentId); //DB call! …
Dennis
  • 7,907
  • 11
  • 65
  • 115
2
votes
1 answer

Coupling with ConfigurationManager or passing parameters from one to another

Is it OK to get parameters for different level of system directly from configuration? I mean specifically coupling every layer with ConfigurationManager in .Net instead of passing parameters by the creator through a constructor or somehow else.
SerG
  • 1,251
  • 4
  • 18
  • 37
2
votes
1 answer

What is the best way to decouple a caller of spawn from the spawned procedure?

Rust 0.12. Let's say I have a sendable closure, that is defined entirely separately from the code that should spawn it in another task. Closure type: type closure_type = ||: 'static + Send; Code: let do_stuff : closure_type = || println!("stuff");…
Nercury
  • 344
  • 1
  • 9
2
votes
1 answer

Django pluggable dynamic navigation app

I want to decouple my big Django app into multiple apps. There is a problem however: navigation. Each application should be able to add its own menu items, leaving other apps' navigation visible. I don't think it is possible with simple template…
utapyngo
  • 6,946
  • 3
  • 44
  • 65
2
votes
1 answer

What is the best way for a mesh class structure in Delphi?

I want to create a triangluar mesh structure in Delphi XE5. The main TMyMesh class has generic TObjectLists to hold the list of vertices, faces, etc. Let's say I have to calculate somthing for every face of the mesh. I could let take the TMyMesh…
user3384674
  • 759
  • 8
  • 28
2
votes
2 answers

Better alternative to static events

I'm writing a simple game in Unity, and learning C# on my own. Currently I'm doing first pass on the scoring system. I decided to do this with native c# events. So my first idea was to have the Score class responsible for counting/keeping player…
user3254257
2
votes
1 answer

Coupling in Enumerations

I've come across some examples of state machines written as enumerations. For instance: public enum State { INITIAL { @Override public State process(char ch) { return MIDDLE; } }, MIDDLE { @Override …
afsantos
  • 5,178
  • 4
  • 30
  • 54
2
votes
3 answers

Decoupling django apps 2 - how to get object information from a slug in the URL

I am trying to de-couple two apps: Locations - app containing details about some location (town, country, place etc) Directory - app containing details of places of interest (shop, railway station, pub, etc) - all categorised. Both…
Guy Bowden
  • 4,997
  • 5
  • 38
  • 58
2
votes
2 answers

How applicable is the command pattern in this attempt to decouple layers?

In past projects I've noticed that many maintainability problems arise from the wide spread mixup of data access and business logic, and high dependancy of logic on entities. I'm not attempting to design a hypothetical system that avoids all of…
Korijn
  • 1,383
  • 9
  • 27
2
votes
5 answers

Advice writing Losely Coupled code with Agile methods or otherwise

I have been reading Robert C. Martin's (aka Uncle Bob) books very intensely as of late. I have found a lot of the things he talks about to be real life savers for me (small function size, very descriptive names for things, etc). The one problem I…
Matthew Stopa
  • 3,793
  • 6
  • 42
  • 51
2
votes
1 answer

Defining name strings for NSNotification usage without coupling

I'm going to be using NSNotifications in my app to decouple the code. I want the compiler to help me when using strings as the names of the notifications, ie, if I mistype one, I want the compiler to tell me. Using normal strings for this won't…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
2
votes
1 answer

Separation of concerns - how to achieve with this code

I have the following scenario (this fits into a larger mvc framework) There is a large xml config which defines model types that are available to a specific feature of the system: 1
Marty Wallace
  • 34,046
  • 53
  • 137
  • 200
2
votes
1 answer

Backbone, rails, cross-domain and front-end / back-end decoupling?

I need to decouple front-end and back-end. I am using Rails for back-end and Backbone for front-end. After a couple days of trial and error I was able to setup CORS on the server. All thanks to this…
Stpn
  • 6,202
  • 7
  • 47
  • 94