Questions tagged [loose-coupling]
207 questions
188
votes
20 answers
What is "loose coupling?" Please provide examples
I can't seem to grok the concept of "loose coupling." I suppose it doesn't help that the word "loose" usually has a negative connotation, so I always forget that loose coupling is a good thing.
Will somebody please show some "before" and "after"…

trebormf
- 3,156
- 3
- 25
- 21
57
votes
5 answers
Is dependency injection useful in C++
C# uses Dependency Injection (DI) a lot to have a lossless and testable platform. For this, I need an interface and maybe a DI or Inversion of Control (IoC) container for resolving my instances.
But how do you do this in C++? I've read a little bit…

Marcel Hoffmann
- 973
- 1
- 8
- 15
43
votes
10 answers
How to understand the big picture in a loose coupled application?
We have been developing code using loose coupling and dependency injection.
A lot of "service" style classes have a constructor and one method that implements an interface. Each individual class is very easy to understand in isolation.
However,…

WW.
- 23,793
- 13
- 94
- 121
29
votes
13 answers
Why should a web architecture be loosely coupled?
When I look at ASP.NET MVC projects I everytime see loose coupled architecture.
For what do I need a loose coupling in a web architecture (if I do not make unit tests)?
What are advantages and disadvantages of this?
What is the main reason to…

Rookian
- 19,841
- 28
- 110
- 180
16
votes
13 answers
Which patterns for loose coupling do you use most?
Lately I have seen a lot of blog posts concerning how to build loosely coupled applications. Which patterns do you use most when creating loosely coupled applications? Dependency Injection? Inversion of Control?

Fossmo
- 2,862
- 4
- 25
- 47
13
votes
9 answers
Why is tightly coupled bad but strongly typed good?
I am struggling to see the real-world benefits of loosely coupled code. Why spend so much effort making something flexible to work with a variety of other objects? If you know what you need to achieve, why not code specifically for that purpose?
To…

JLX
- 219
- 2
- 4
11
votes
6 answers
Handling interdependent and/or layered asynchronous calls
As an example, suppose I want to fetch a list of files from somewhere, then load the contents of these files and finally display them to the user. In a synchronous model, it would be something like this (pseudocode):
var file_list =…

Confluence
- 1,331
- 1
- 10
- 26
10
votes
5 answers
Is it a leaky abstraction if implementation of interface calls Dispose
Consider this code:
public class MyClass()
{
public MyClass()
{
}
public DoSomething()
{
using (var service = new CustomerCreditServiceClient())
{
var creditLimit = service.GetCreditLimit(
customer.Firstname,…

Jon
- 38,814
- 81
- 233
- 382
8
votes
5 answers
How to Implement Loose Coupling with a SOA Architecture
I've been doing a lot of research lately about SOA and ESB's etc.
I'm working on redesigning some legacy systems at work now and would like to build it with more of a SOA architecture than it currently has. We use these services in about 5 of our…
user300183
8
votes
2 answers
separation of concerns vs loose coupling
I would like to understand the difference between separation of concerns and loose coupling.
Is it true that coding by separation of concerns gives a loosely coupled code?
Thank you.

MoShe
- 6,197
- 17
- 51
- 77
7
votes
4 answers
Loose Coupling and OO Practices for Beginners
Keeping classes loosely coupled is an important aspect of writing code that is easy to understand, modify, and debug--I get that. As a newbie, though, just about anytime I get beyond the most simple examples I struggle.
I understand, more or less,…

Al C
- 5,175
- 6
- 44
- 74
7
votes
2 answers
Best way to structure the code for an ASP.NET MVC REST API that is decoupled from the data formats?
I am creating a REST API in ASP.NET MVC. I want the format of the request and response to be JSON or XML, however I also want to make it easy to add another data format and easy to create just XML first and add JSON later.
Basically I want to…

MetaGuru
- 42,847
- 67
- 188
- 294
7
votes
4 answers
Loosely Coupled Database Design - How To?
I'm implementing a web - based application using silverlight with an SQL Server DB on the back end for all the data that the application will display. I want to ensure that the application can be easily scalable and I feel the direction to go in…

Goober
- 13,146
- 50
- 126
- 195
7
votes
1 answer
Exposing std::vector over a dll boundary - best practice for compiler independence
Exposing STL containers over DLL boundaries is not a good idea, and generally not possible (see this answer for why, and this one about exposing a std::list over a dll boundary). I need to be able to pass data between DLL and EXE compiled with…

Phil H
- 19,928
- 7
- 68
- 105
7
votes
3 answers
Reducing coupling simple example needed for beginner
Just out of college and am coming across some code where I need to reduce coupling. But I don’t understand fully all the concepts and would like a simple example to help me. To get you started I have a person class with a single field, name. I have…

Francis Rodgers
- 4,565
- 8
- 46
- 65