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

Decoupling via Interfaces in Go... Slice of interface implementors?

OK. I know this is a FAQ, and I think the answer is "give up, it doesn't work that way", but I just want to make sure I'm not missing something. I am still wrapping my head around best practices and rules for use of interfaces. I have code in…
mjmac
  • 172
  • 5
4
votes
1 answer

Is it an anti-pattern to instantiate models in views in Backbone.js?

When developing Backbone applications, I often find myself instantiating models in views when dealing with nested data. Here's some example data: { name: Alfred, age 27, skills: [ { name: 'Web development', level: 'Mediocre' …
user1781186
4
votes
1 answer

Strategy pattern: coupled strategy vs uncoupled strategy

What´s the difference between a coupled strategy and an uncoupled strategy? Thanks for answering.
MQSJ23
  • 107
  • 2
  • 2
  • 6
4
votes
1 answer

How to decouple a data core domain from a REST domain?

I am curious on what is the preferred way to decouple a core domain entity from the entity served by a REST layer. I saw on this enlightening Spring REST tutorial http://spring.io/guides/tutorials/rest/1/ that it's a good thing not to expose the…
Stephane
  • 11,836
  • 25
  • 112
  • 175
4
votes
1 answer

Decouple AutobahnJS (WebSockets) with Backbone

I have a backbone app that have simple search form, when the user writes something on this search I use autobahn to subscribe the given text on the search form (for example - I search for "foo", I subscribe for "foo"). How can I separate autobahn…
Yosi
  • 2,936
  • 7
  • 39
  • 64
4
votes
1 answer

Menu service in Prism application CAL

I am trying to create a Prism (CAL) framework (this is my first forray into CAL) and am having difficulty devising a service for registering menu items for a region). Here is what I have come up with so far... /// /// Menu item service -…
Jason
  • 223
  • 3
  • 9
4
votes
1 answer

Rails apps that decouple ActiveRecord from Business Logic

I recently came across Robert Martin's (Uncle Bob) keynote on how to structure a rails app based on use-cases. I found this very interesting. Here is the link to the keynote: Architecture: the Lost Years Here is a sample project that structures the…
Karan
  • 14,824
  • 24
  • 91
  • 157
4
votes
1 answer

Should all objects be decoupled

I have one question that I can't seem to get answered anywhere. It's in regards to decoupling your code with interfaces. The question is - should ALL objects inside other objects (being created and used) be refactored into an interface to follow the…
chuckd
  • 13,460
  • 29
  • 152
  • 331
3
votes
1 answer

Python detect new connection to wifi

I saw a tutorial on YouTube(I can't link it because I can't find it anymore), So the code is supposed to detect devices that are connected to my Internet/Router, I don't understand a lot about how his(The person who made the tutorial) code works I…
French Noodles
  • 127
  • 1
  • 9
3
votes
1 answer

Linq async interface without EF Core

Let's say I have a query in EF Core that looks like so: MethodWithDomainLogic() { return this.dbContext.People.Where(...).ToListAsync(); } Now, in an effort to decouple my domain layer from my data access layer, I want this method to be in my…
Ian Kirkpatrick
  • 1,861
  • 14
  • 33
3
votes
2 answers

Should Microservices be reusable?

Should Microsercices be reusable? With reusable I do NOT mean sharing Domain specific Models. I mean should a microservice created for one application be reuseable in another application? Is it sufficient if they are reusable within an…
3
votes
1 answer

Encapsulation of third party configuration structs

I am working on a Go project where I am utilizing some rather big third-party client libraries to communicate with some third-party REST apis. My intent is to decouple my internal code API from these specific dependencies. Decoupling specific…
Matthias Preu
  • 783
  • 2
  • 8
  • 18
3
votes
5 answers

CSS and Javascript too tightly coupled (CSS is not just presentation but is used by UI and JS), how to improve this?

I think supposedly, an ideal way is that CSS only deals with presentation aspect of a document, and so CSS and Javascript are de-coupled and it is a very clean solution. We can change any CSS or any Javascript without breaking the other. But what…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
3
votes
2 answers

Decoupling algorithm from data, when the algorithm needs knowledge of derived classes

Sorry for the complicated title, but it's a bit hard to explain in just one sentence. So I'm writing a simple interpreted language to help with some stuff that I often do. I have a lexer set up, feeding into an abstract syntax tree generator. The…
Thor Correia
  • 1,159
  • 1
  • 12
  • 20
3
votes
1 answer

Return object with spring events?

I have maven module_A service rom where i need to call module_B service. Intention is to keep the coupling minimum Approach1:- This is approach we are generally used to. module_B will be injected under module_A and the call service_B from…
user3198603
  • 5,528
  • 13
  • 65
  • 125