coupling

Enforcing DLL Dependencies

Background My solution consists of two projects: A standard Windows application A DLL which my application does not use directly, but instead injects it into a target process Basically, from my application's perspective, the only requirement that the DLL must meet is to be present in the working directory of my application. In short...

Why are Mediators coupled to Proxies in Flex PureMVC?

I've just recently learned the PureMVC framework, and am a little confused as to the coupling between Proxy and Mediator objects. The links on this page connect to some documents describing the framework. (Please note, the links on the aforementioned page open PDFs.) The diagrams and examples of PureMVC I've examined often show a dire...

Removing tightly coupled code.

Forgive me if this is a dupe but I couldn't find anything that hit this exact question. I'm working with a legacy application that is very tightly coupled. We are pulling out some of the major functionality because we will be getting that functionality from an external service. What is the best way to begin removing the now unused cod...

Alternatives to "using" 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 a project reference and a using statement? I remember V6 used to let you create an obj...

Should a service be given a reference to another, or should the caller gain extra responsibility?

There are two classes in my project (using ASP.NET MVC): AuthenticationService, and ProfileService. When a new user registers at my site the Authentication controller's Register action calls a Register method in IAuthenticationService, which creates an authentication record for the user according to whichever concrete authentication modu...

How should I inherit IDisposable?

Class names have been changed to protect the innocent. If I have an interface named ISomeInterface. I also have classes that inherit the interface, FirstClass and SecondClass. FirstClass uses resources that must be disposed. SecondClass does not. So the question is, where should I inherit from IDisposable? Both of the following opt...

Best practices for creating libraries that use .NET namespaces

Is it bad practice to write a library that defines an interface dependent on another library? I know tight coupling is bad, but does this still apply when using .NET classes? For example, in .NET, if I have a library that returns a Color object, it would force a dependancy on System.Drawing on anything that uses my library. Would I be...

MVC coupling between models

Can a model depend on another model? Say I have a log model that other models want to access. ...

Composition vs. Inheritance: Is the need for mutual referencing a good hint?

If two classes both need to know about each other to do their job, i.e. class A must maintain a reference to class B and class B must maintain a reference to class A, is this generally a sign that inheritance would be a better idea than composition, provided you aren't violating the Liskov Substitution principle? My thinking is that thi...

Design Question - OO food application

Say I have a number of usercontrols, each usercontrol inside a tabitem, inside a window. For example, let say this is a food collection application. Then we have tabs Fruit, Vegetables and Snacks. Each tab will show a list of food of that subject, and allow the user to add, delete, modify the food in each section. The food is stored in ...

Making OR/M loosely coupled and abstracted away from other layers.

Hi all. In an n-tier architecture, the best place to put an object-relational mapping (OR/M) code is in the data access layer. For example, database queries and updates can be delegated to a tool like NHibernate. Yet, I'd like to keep all references to NHibernate within the data access layer and abstract dependencies away from the lay...

Coupling between controller and view

The litmus test for me for a good MVC implementation is how easy it is to swap out the view. I've always done this really badly due to being lazy but now I want to do it right. This is in C++ but it should apply equally to non-desktop applications, if I am to believe the hype. Here is one example: the application controller has to check...

How to avoid coupling when using regions in Composite WPF

I have an application designed using Microsoft's Composite Application Library. My shell has several regions defined so that I can inject content from separate modules. I'm looking for a design pattern that will reduce the coupling that these regions introduce. In all examples I have seen, regions are defined and accessed using a string...

Seperation of game- and rendering logic

What is the best way to seperate rendering code from the actually game engine/logic code? And is it even a good idea to seperate those? Let's assume we have a game object called Knight. The Knight has to be rendered on the screen for the user to see. We're now left with two choices. Either we give the Knight a Render/Draw method that we...

Cohesion and Decoupling.

Can anyone tell me what are Cohesion and Decoupling? I found coupling but there is no Decoupling anywhere. I need to learn their meanings. Any help will be appreciated. Thanks for replying. ...

Law of Demeter and return values

According to the Law of Demeter, can you call methods on returned objects? E.g. <?php class O { public function m($http) { $response = $http->get('http://www.google.com'); return $response->getBody(); // violation? } } ?> $http->get() returns an object. Does this count as an object created/instantiated wit...

Do complex JOINs cause high coupling and maintenance problems ?

Our project has ~40 tables with complex relations.A colleague believes in using long join queries which enforces me to learn about tables outside of my module but I think I should not concern about tables not directly related to my module and use data access functions (written by those responsible for other modules) when I need data from...

Is it OK to exchange tuples between Python modules ?

I have a small Python program consisting of very few modules (about 4 or so). The main module creates a list of tuples, thereby representing a number of records. These tuples are available to the other modules through a simple function that returns them (say, get_records()). I am not sure if this is good design however. The problem be...

How to make a design "loose coupling"?

I'm making a simple 3D CAD software. in the class diagram, many objects need to distinguish with others by (x,y,z). I create a class so-called "Position", but the problem is it looks highly-coupling because many classese work with position. Any ideas? ...

Object-oriented Paradigm Question...

Even though I've been programming for quite a while now, when it comes to coupling objects I always seem to bang my head against the wall so I'm wondering if anyone has any resources or golden rules I can follow. Let me give a small example, in no particular language... class Person { private int personnel_id private String fir...