The coupling tag has no wiki summary.
4
votes
1answer
166 views
Explanation of Object-parameter-coupling as mentioned in Code Complete book
I have been reading up on the seminal and excellent book Code Complete. It discusses about the various kinds of couplings that can happen between modules(which may be classes as well as methods):
...
7
votes
7answers
440 views
Is a pair of two tightly coupled classes any better than a single, larger class?
I'm rewriting somebody else's code at the minute, and I came across two classes which reference each other directly and call methods on each other. Like so (example in C#):
class A {
B otherClass;
...
14
votes
3answers
429 views
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 ...
3
votes
2answers
134 views
Automated object creation from user input
I am working on a command-line application that runs simulations. It has to be heavily configurable; the user should be able to provide a very large number (100+) of parameters, some mandatory and ...
4
votes
2answers
286 views
When is Efferent / Afferent coupling good or bad
I have a software patterns exam this week and one of the topics we are to study is Efferent and Afferent coupling.
I understand a package has a high Ce (efferent coupling) if it depends on a number ...
2
votes
2answers
209 views
Architecture Best Practice (MVC): Repository Returns Object & Object Member Accessed Directly or Repository Returns Object Member
Architecturally speaking, which is the preferable approach (and why)?
$validation_date = $users_repository->getUser($user_id)->validation_date;
Seems to violate Law of Demeter by accessing ...
2
votes
2answers
48 views
Should I use structure from a core library graphic toolkit in my domain?
In java (and many other programming language), there are often structure to deal with graphic element : Colour, Shape, etc. Those are most often in a UI toolkit and thus have a relatively strong ...
6
votes
4answers
279 views
Achieving decoupling in Model classes
I am trying to test-drive (or at least write unit tests) my Model classes but I noticed that my classes end up being too coupled. Since I can't break this coupling, writing unit tests is becoming ...
6
votes
2answers
313 views
Have I mistakenly assumed that my routines are loosely coupled?
My Selenium test structures goes as -
Data Object class -
public class RegistrationData {
String firstName = "test first name";
String lastName = "test last name";
// Getter Setter Here
}
...
6
votes
5answers
334 views
TDD: Mocking out tightly coupled objects
Sometimes objects just need to be tightly coupled. For example, a CsvFile class will probably need to work tightly with the CsvRecord class (or ICsvRecord interface).
However from what I learned in ...
1
vote
3answers
311 views
What are the problems which I will face if all the classes I use are loosely coupled
Loosely coupled classes gives flexibility. If I understand it right, Event flow, Observer Pattern and Design Patterns like MVC focus on loose coupling. So in this context I am aiming towards making a ...
11
votes
4answers
714 views
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)
...
8
votes
2answers
206 views
Low coupling processing big quantities of data
Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure ...
2
votes
3answers
433 views
What code smell best describes this code?
Suppose you have this code in a class:
private DataContext _context;
public Customer[] GetCustomers()
{
GetContext();
return _context.Customers.ToArray();
}
public Order[] GetOrders()
{
...
7
votes
5answers
256 views
Splitting 1 large object into 2 tightly-coupled ones - good, bad?
I have a complex object (call it BusinessLogic) which provides an RPC interface to semi-trusted users. The functions in the RPC interface have to decide which procedure to call, check authorisation ...
5
votes
2answers
251 views
God Namespace just as bad as God Object?
We have about 3/4 different projects, each sharing a certain level of data. Some data is not shared, but all the data access has ended up in a single namespace that is included in every project.
...
15
votes
8answers
909 views
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 ...
7
votes
2answers
1k views
Decoupling UI code?
In my application I have several event handlers that perform some action in response to user interface events such as a button click or menu selection. The code in these event handlers looks like ...
3
votes
2answers
122 views
Displaying and processing objects in a list?
I currently have code like this to display some objects that meet some criteria in a grid:
// simplified
void MyDialog::OnTimer()
{
UpdateDisplay();
}
void MyDialog::UpdateDisplay()
{
...
3
votes
3answers
366 views
Do mixins create coupling with Ruby?
Let's say I have the following architecture:
module Keyring
@keyring = Keyring.new
class Keyring
def key
def add_key
def update_key
def remove_key
class ...
0
votes
3answers
605 views
Improving Cohesion and Coupling of Classes
I am given this set of code and need to suggest ways to improve the code's cohesion and coupling of the classes. But I thought these classes are quite well de-coupled since it looks like they are ...
7
votes
7answers
850 views
Coupling. Best practices
Following on from this thread I started
The Singleton Pattern
It got me thinking about how coupled my classes are and how best to achieve loose coupling. Please bear in mind I am a new programmer ...
