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
5
votes
2 answers

Decoupling Entity Framework in MVC3 Application

I have a few questions regarding decoupling my domain layer and data layer in an MVC3 web application using entity framework as the data access layer. As it stands right now my controllers are completely dependant on the EF classes and after…
Grant
  • 11,138
  • 32
  • 94
  • 140
5
votes
5 answers

Alternatives to the "using" directive keyword in C#?

I just finished watching an episode of Bob Martin at NDC where he said "using" directives in C# at the top of a page are bad because of the tight coupling they create/imply between components. What way are there to use external .dlls without adding…
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
4
votes
2 answers

Using delegates instead of interfaces for decoupling. Good idea?

When writing GUI apps I use a top level class that "controls" or "coordinates" the application. The top level class would be responsible for coordinating things like initialising network connections, handling application wide UI actions, loading…
sipsorcery
  • 30,273
  • 24
  • 104
  • 155
4
votes
2 answers

Best place for serialisation code. Internal to class being serialised, or external class per format?

I often find myself in a quandary in where to put serialisation code for a class, and was wondering what others' thoughts on the subject were. Bog standard serialisation is a no brainer. Just decorate the class in question. My question is more for…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
4
votes
2 answers

symfony 2.0 bundles interworking

I want to make an application based on a main bundle leaving the possibility for other developers to make their own bundles to implement other features. Symfony 2.0 seems a good choice for that however I cannot figure out how to let the bundles to…
4
votes
3 answers

DataTable Wrapper or How to decouple UI from Business logic

I am using web forms, C#, Asp.net. As we all know, in this model UI and business logic are often mixed in. How do I separate these effectively? The example I would like to use is: I have a GridView and a DataTable (GridView binds to the DataTable…
sarsnake
  • 26,667
  • 58
  • 180
  • 286
4
votes
3 answers

Dependency Injection - Is it better to pass a complete class, or the name of a class?

For dependency injection, I understand that I have to pass an instance of one class to the main instance instead of the main class creating it's own instance, like so (php): class Class_One { protected $_other; public function setOtherClass(…
manbeardpig
  • 459
  • 1
  • 6
  • 12
4
votes
1 answer

Nested MVP on Android: how to

I am working on an Android test project composed of 3 main parts, each of which developed following the MVP pattern. These parts are nested into each other and I would like to know if the strategy I am following is the correct/best one or…
kioli
  • 635
  • 1
  • 10
  • 26
4
votes
2 answers

Decoupling classes C#

This might be a bit vague, but I am working on a program where several classes that update the UI. I have made a "middle-man" class that basically takes all the UI requests (among other things) and routes them to the UI itself, that way the UI class…
user472875
  • 3,115
  • 4
  • 37
  • 68
4
votes
5 answers

How to enforce constraints between decoupled objects?

Note - I have moved the original post to the bottom because I think it is still of value to newcomers to this thread. What follows directly below is an attempt at rewriting the question based on feedback. Completely Redacted Post Ok, I'll try to…
fostandy
  • 4,282
  • 4
  • 37
  • 41
4
votes
2 answers

Java: Is there use to refactoring/decoupling if only one class will use the new class?

Code: public class Name { private String[] name; private String first; private String middle; private String last; private String suffix; public Name (String fullName) { //Name is parsed in constructor parse1(); parse2(); …
mpmp
  • 2,409
  • 4
  • 33
  • 46
4
votes
2 answers

Splitting a Symfony 2 project?

We have a pretty large Symfony 2 web application which has many different endpoints and features: api for data from our legacy product web components for use in our legacy product api to our new iOS POS api to loyalty end-user portal web interface…
Rein Baarsma
  • 1,466
  • 13
  • 22
4
votes
2 answers

How to handle generic classes / interfaces in a modular application?

I am new to Java and I am coding up a modular application made like this: ************* ******* *********** * * * * * Data * * Front-end * -------- * API * ------- * Handler * * * …
nzapponi
  • 476
  • 1
  • 3
  • 14
4
votes
1 answer

Dependency Injection and decoupling of software layers

I am trying to implement Dependency Injection to make my app tester friendly. I have a rather basic doubt. Data layer uses SqlConnection object to connect to a SQL server database. SqlConnection object is a dependency for data access layer. In…
cs31415
  • 169
  • 3
  • 12
4
votes
2 answers

Efficiently pass notifications between decoupled design layers

I am upgrading a design where data was lightly coupled with the UI: class Object { UI * ui; }; class UI { Object * object; }; It was fairly straightforward to push update notifications to the ui through the UI pointer, but new…
dtech
  • 47,916
  • 17
  • 112
  • 190