Questions tagged [coupling]
151 questions
169
votes
9 answers
I changed one method signature and now have over 25,000 errors. What now?
I started a new job recently where I am working on a very large application (15M loc). In my previous job we had a similarly large application but (for better or for worse) we used OSGi, which meant the application was broken down into lots of…

user788497
- 1,321
- 2
- 9
- 6
52
votes
11 answers
How do I avoid cascading refactorings?
I've got a project. In this project I wished to refactor it to add a feature, and I refactored the project to add the feature.
The problem is that when I was done, it turned out that I needed to make a minor interface change to accommodate it. So I…

DeadMG
- 36,794
- 8
- 70
- 139
51
votes
5 answers
Where should you put constants and why?
In our mostly large applications, we usually have a only few locations for "constants":
One class for GUI and internal contstants (Tab Page titles, Group Box titles, calculation factors, enumerations)
One class for database tables and columns (this…

Tim Meyer
- 833
- 1
- 8
- 14
46
votes
6 answers
Why is "tight coupling between functions and data" bad?
I found this quote in "The Joy of Clojure" on p. 32, but someone said the same thing to me over dinner last week and I've heard it other places as well:
[A] downside to object-oriented programming is the tight
coupling between function and…

GlenPeterson
- 14,890
- 6
- 47
- 75
34
votes
3 answers
How does dependecy injection increase coupling?
On the Wikipedia page on dependency injection, the disadvantages section tells us this:
Dependency injection increases coupling by requiring the user of a subsystem to provide for the needs of that subsystem.
with a link to an article against…

BЈовић
- 13,981
- 8
- 61
- 81
28
votes
5 answers
I'm not seeing 'tightly coupled code' as one of the drawbacks of a monolithic application architecture
One of the most common things I see when discussing pros/cons of microservice vs monolithic architecture is that monolithic applications have, or always trend toward, 'tight coupling.'
To be honest, I'm not seeing why this is true if your developers…

Bob Dole
- 421
- 4
- 3
28
votes
9 answers
In software design, should an application remain agnostic regarding its usage with real world data / mock data?
Let me try to summarize a bit more with a simple example:
You're building a large application, a user portal for example, with feeds, news, account management, and a whole range of difference features.
During development it's decided you need to…

SikoSoft
- 405
- 4
- 5
27
votes
6 answers
Coupling: Theory vs Reality
Coupling is defined as the knowledge one object has about another one, which describes how dependent they are. The more dependent, the worse, since changes in one would impact in the second. High coupling is bad, low coupling good. There are…

Asier Naiz
- 411
- 4
- 6
23
votes
3 answers
How to decouple UI from logic on Pyqt/Qt apps properly?
I've read quite a lot about this subject in the past and watched some interesting talks like this one from Uncle Bob's. Still, I always find pretty difficult to architect properly my desktop applications and distinguish which should be the…

BPL
- 455
- 1
- 4
- 11
23
votes
5 answers
Why would a type be coupled with its builder?
I've recently deleted a java answer of mine on Code Review, that started like this:
private Person(PersonBuilder builder) {
Stop. Red flag. A PersonBuilder would build a Person; it knows about a Person. The Person class shouldn't know anything…

Mathieu Guindon
- 1,720
- 16
- 33
22
votes
3 answers
Unit testing behaviours without coupling to implementation details
In his talk TDD, where did it all go wrong, Ian Cooper pushes Kent Beck's original intention behind unit testing in TDD (to test behaviours, not methods of classes specifically) and argues for avoiding coupling the tests to the implementation.
In…

Andy Hunt
- 5,996
- 1
- 33
- 56
19
votes
4 answers
Event-driven programming: when is it worth it?
Ok, I know the title of this question is almost identical to When should I use event based programming? but the answers of said question have not helped me in deciding whether I should use events in the particular case I'm facing.
I'm developing a…

abl
- 471
- 3
- 12
19
votes
3 answers
Does decoupling trump DRY in REST?
I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence over both APIs but am implementing the REST one. …

Will
- 712
- 5
- 12
17
votes
8 answers
Is coupling with strings "looser" than with class methods?
I'm starting a school group project in Java, using Swing. It's a straightforward GUI on Database desktop app.
The professor gave us the code from last year's project so we could see how he does things. My initial impression is that the code is far…

Philip
- 672
- 1
- 6
- 16
16
votes
7 answers
Where should interfaces be used?
One thing I've long struggled with being able to grasp properly is, when designing a program in an object-oriented language, where and how should explicitly named/defined interfaces be added? In particular, I have heard at least the following…

The_Sympathizer
- 447
- 3
- 9