Questions tagged [coupling]
197 questions
2
votes
2 answers
When is it OK to blur the abstraction between data and logic?
I mean referring to specific database rows by their ID, from code, or specifying a class name in the database. Example:
You have a database table called SocialNetwork. It's a lookup table. The application doesn't write or or delete from it. It's…

Sean
- 1,668
- 1
- 18
- 28
2
votes
2 answers
Cohesion VS. Coupling
This question will treat software like a tree, where:
Each node in the tree represents some code unit (eg class \ method \ line etc.)
Node X is son of Node Y if in the source code X is set in Y
Here is the definition of the term T:
T relative to…

idan mor
- 23
- 3
2
votes
1 answer
Copy value of partnered (infant) variable to original (mother)
I have Dyadic (mother/infant) repeated measures data in long form.
I have three ID variables: Individual ID, Dyad ID, and "status".
ID
DYAD
Status
date
infant…

Emma
- 23
- 3
2
votes
1 answer
Keeping Coupling Low While Adhering to DRY
The mantra "Keep high cohesion and low coupling" (or some variant) is frequently tossed around. However, I find that it frequently conflicts with "Don't repeat yourself."
For example, I think we can all agree that it's a bad thing to re-implement…

Maxpm
- 24,113
- 33
- 111
- 170
2
votes
1 answer
When does improving program cohesion worsen coupling?
I recently took an exam on design principles & patterns, and one of the questions in the exam was as follows : "Sometimes improving program cohesion may worsen coupling, give an example."
From what I understand, cohesion is how focused a…

Some Student
- 67
- 5
2
votes
4 answers
coupling str elements from a list to a tuple list
I have the following list:
lines
['line_North_Mid', 'line_South_Mid',
'line_North_South', 'line_Mid_South',
'line_South_North','line_Mid_North' ]
I would like to couple them in a tuple list as follows, with respect to their…

oakca
- 1,408
- 1
- 18
- 40
2
votes
1 answer
Loose coupling vs tight coupling of services
I understand that we at almost all times want to aim for loose coupling between components within an application & why.
But in the below example if someone could clarify as to why it isn't tightly coupled when we pass in a service as a parameter to…

Munerz
- 1,052
- 1
- 13
- 26
2
votes
2 answers
Are Swift segues closely coupled?
In Swift using MVC a common way to send data forward is to use prepare(for:sender:). Inside that method you get a reference to the destination VC and access its properties to send the data. But isn't that considered coupling the view controllers?…

squarehippo10
- 1,855
- 1
- 15
- 45
2
votes
5 answers
ORM - specific to SQL Server 2008+ for .NET
Is there an ORM tied to MS SQL 2008+, generating .NET code, which takes advantage of MS SQL specific features?
I'm specifically interested in 2 features:
(1) fetching a group of records by their key, which will not be mapped to "select in"…

Ron Klein
- 9,178
- 9
- 55
- 88
2
votes
1 answer
Law of Demeter: Argument method clarification
So the law of demeter essentially aims to reduce coupling between modules. I am working on writing out some examples to ensure that I understand the concept conceptually. The code that I have written is below, and would just like clarification. From…

tara
- 23
- 3
2
votes
1 answer
Is it acceptable for a class to have its properties used ONLY by the outside environment?
Sometimes we run into a problem where a class doesn't need to use its own properties. See approach A:
struct Ball {
double mass = 1;
double x = 0;
double y = 0;
};
struct World {
std::vector balls;
void run_physics() {
…

Liakos
- 512
- 5
- 10
2
votes
1 answer
Laravel DI coupling differences
What is the difference in class coupling if you use these 3 types of usages:
Case 1
use UserRepository
...
UserRepository::getUser();
Case 2
App::make('UserRepository')->getUser();
Case 3
public function __construct(UserRepository…

Norgul
- 4,613
- 13
- 61
- 144
2
votes
5 answers
Microservice Coupling
I'm building a new application with microservice concepts, but I don't know how to communicate with another microservice without coupling. Here is my scenario.
I want to show a graphic bar about my sales but I have two microservices, the first one…

melpin
- 33
- 2
- 6
2
votes
2 answers
Microservices and coupling
I am trying to use some kind of microservice architecture. I am trying to use HTTP and JSON as a communication medium (I know better than to call it ReST).
So, I'm using spring-mvc and I wanted to use a class as a ResponseBody on the called and as…

Amanuel Nega
- 1,899
- 1
- 24
- 42
2
votes
1 answer
Why singleton makes coupling?
I read a lot about singleton is tightly couple but I do not understand how it is tightly coupled. Can you give small example for that?

cincin
- 67
- 1
- 7