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

Spring 3 in maven multi-module configuration, wise or not?

Could you recommend me the way good way how to split web application and API+db stuff into two maven modules (with one parent) ? I am struggling mainly with Spring configuration. -> (contains spring…
Martin V.
  • 3,560
  • 6
  • 31
  • 47
2
votes
2 answers

how to use interface in C#

Using C# .NET 4.0, Visual Studio 2010. Well at the moment I'm looking into de-coupling of Classes and using interfaces. I've implemented a Solution from another post to test if I could get it working but unfortunately I have never used an interface…
lemunk
  • 2,616
  • 12
  • 57
  • 87
2
votes
1 answer

Poking around in parent's internal state

tl:dr how does decoupling work? could need some little example I'm reading Programming Ruby - The Pragmatic Programmer's Guide. (http://ruby-doc.org/docs/ProgrammingRuby/html/tut_classes.html) There is an example on how to implement to_s for…
2
votes
2 answers

How can I decouple $_POST/$_GET handling code from html forms/urls? (PHP-OOP)

In a class I have a handling method which performs actions based on what post/get variables are available. Here is a simplified example: public function handleAll(array $vars) { if (isset($vars['var1'])) { …
Jonathan
  • 1,256
  • 4
  • 12
  • 18
1
vote
2 answers

How should I handle lookups in my ViewModel?

My database table for buildings stores the building type as a code. In a separate lookup table the description for that code is stored. How should I design my ViewModel and where will I need to make the call to get the associated description…
Doug Chamberlain
  • 11,192
  • 9
  • 51
  • 91
1
vote
1 answer

Preventing State-Coupling?

I have the following objects and relationships, Lecture >- Tests Test >- Questions Business rules When the lecture is started, a test can be given If a test is being given, questions can be asked Inference Therefore questions shouldn't be asked…
Allyl Isocyanate
  • 13,306
  • 17
  • 79
  • 130
1
vote
3 answers

API library decoupling approaches?

Imagine a set of libraries that represent some APIs. By using an inversion of control mechanisms, concrete implementations will be injected in a consuming project. Here is a situation. I have some of the API libraries depending on other API…
Ivaylo Slavov
  • 8,839
  • 12
  • 65
  • 108
1
vote
1 answer

MVC asp.net - should data access layer be decoupled from domain models?

If I follow decoupling all the way, it would appear that DataAccess layer should be de-coupled from models. But then passing the information to the data access layer becomes cumbersome...Instead of: void Save(myModel modelObject) { //db.Save…
sarsnake
  • 26,667
  • 58
  • 180
  • 286
1
vote
1 answer

Should Business Logic objects have knowledge of their LINQ-to-SQL data objects?

I've looked at several similar questions but I didn't see any that directly applied to me, so forgive me if this is a duplicate. For separation of concerns I'm trying to somehow map my business objects with logic to the LINQ to SQL data objects in…
Davy8
  • 30,868
  • 25
  • 115
  • 173
1
vote
3 answers

Public static data used throughout program

Code examples are C# but this is a general OO question. I know according to OO rules, class coupling should be minimised and members should be kept private wherever possible, etc. Consider this example: You are writing an esoteric program which has…
Ozzah
  • 10,631
  • 16
  • 77
  • 116
1
vote
3 answers

How best to decouple objects in, for example, a 'snake' game

I am creating a snake game in C#/XNA for fun but it's a good opportunity to practice some good object design. Snake Object There's a snake object which is essentially a linked list, each node being a vector with X & Y co-ordinates which relate to…
managedheap84
  • 841
  • 2
  • 10
  • 22
1
vote
2 answers

Decoupling the Data Layer using Entity Framework

I am using EF 4.0, linq to entities, VS 2010 and SQL Server 2005 Stored Procedures to do a small search application. I have designed the EDM and the required layers. The presentation layer displays the search results properly. The dilemma now is…
Jacob
  • 11
  • 4
1
vote
1 answer

Switching long inheritance tree for composition / agreggation

I have a program in Java which uses a lot of inheritance, and it's making it troublesome to modify and test the final derived classes So I'm refactoring, attempting to switch from inheritance to aggregation / composition. The design in question is…
coz
  • 23
  • 6
1
vote
2 answers

Dependency inversion in python - why is it used? Can't see the benefit

I've been trying to understand dependency inversion in python. I understand the theory that everybody quotes but I've not yet seen the code example with and without inversion that would clearly demonstrate the benefits. I've found only one highly…
1
vote
1 answer

Azure Active Directory SSO (SAML protocol) when frontend is decoupled from backend. How will frontend be notified that validation is completed?

So I would like to add SSO using Azure AD. My stack consists of a React app as frontend and a NestJS API as backend(decoupled). The scenario looks like the following User clicks login button I create a new window (popup) which leads the user to the…