coupling

A python web application framework for tight DB/GUI coupling?

I'm a firm believer of the heretic thought of tight coupling between the backend and frontend: I want existing, implied knowledge about a backend to be automatically made use of when generating user interfaces. E.g., if a VARCHAR column has a maximum with of 20 characters, there GUIs should automatically constrain the user from typing mo...

Should I be more concerned with coupling between packages or between units of distribution?

I have been looking at metrics for coupling and also look at DSM. One of the tools I've been using looks at coupling between 'modules' with a module being a unit of distribution (in this case a .net assembly). I feel that I should be more interested in looking at coupling between packages (or namespaces) than with units of distribut...

Coupling, Cohesion and the Law of Demeter

The Law of Demeter indicates that you should only speak to objects that you know about directly. That is, do not perform method chaining to talk to other objects. When you do so, you are establishing improper linkages with the intermediary objects, inappropriately coupling your code to other code. That's bad. The solution would be fo...

Coupling is too high - how to design this class better?

Running FxCop on my code, I get this warning: Microsoft.Maintainability : 'FooBar.ctor is coupled with 99 different types from 9 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other types it is tightly coupled with. A class coupling above ...

Timers, UI Frameworks and bad coupling - Any Ideas?

Hi, I've just written a small XBox 360 Wireless Controller managed interface that basically wraps around the low-lever SlimDX wrapper library and provides a easy, managed API for the XBOX 360 controller. Internally, the class polls the gamepad every N ms, and shoots events as it detects changes in the underlying state of the controller....

Advice on designing loosely-coupled complete systems?

How does one design loosely-coupled systems which may often require data from each-other but don't necessarily belong in the same category? For instance, lets take the old Pet-shop example one-step further and create a pet-store franchise. Each pet-store has its own website listing their contact information, promotions, and current stoc...

Detecting dependencies between namespaces in .NET

Are there any utilities that can examine a set of managed assemblies and tell you whether any of the types in one namespace depend on any in another? For example, say I have a MyApp.BusinessRules namespace and don't want it to access directly anything in MyApp.GUI, but both namespaces are in the same assembly. My goal is to be able to w...

Conceptual question: Loose Coupling

Hi, I am building a graphic board like project where i am facing a design issue. Main Class is Board which is a canvas responsible for handling mouse events when drawing shapes. It also has context variables such as currentShape or snapFlag to activate grid magnetism. To handle the moving / resizing / rotating of the shapes, they inhe...

How would you improve this simple class to be more loosely coupled?

As you can see below, in the constructor I'm instantiating a validation object so I can validate a user's email in a set method. Is this architecture best practice or flawed? Can I avoid making my User class directly dependent on my Validation class? Class User { Private Email //constructor User() { Validation = new Validation } S...

Loose Coupling vs. Information Hiding and Ease of Change

I'm just reading Code Complete by Steve McConell and I'm thinking of an Example he gives in a section about loose coupling. It's about the interface of a method that calculates the number of holidays for an employee, which is calculated from the entry date of the employee and her sales. The author suggests a to have entry date and sales ...

Is Polymorphism worth an increase in coupling?

I'm writing a simplistic game to learn get some more C++ experience, and I have an idea where I feel polymorphism almost works, but doesn't. In this game, the Party moves fairly linearly through a Map, but can occasionally encounter a Fork in the road. A fork is (basically) an std::vector<location*>.Originally I was going to code somethi...

How to solve the violations of the Law of Demeter?

Me and a colleague designed a system for our customer, and in our opinion we created a nice clean design. But I'm having problems with some coupling we've introduced. I could try to create an example design which includes the same problems as our design, but if you forgive me I'll create an extract of our design to support the question. ...

Decoupling vs YAGNI

Do they contradict? Decoupling is something great and quite hard to achieve. However in most of the applications we don't really need it, so I can design highly coupled applications and it almost will not change anything other than obvious side effects such as "you can not separate components", "unit testing is pain in the arse" etc. W...

Class design

I have 2 classes for the game i am making, gui class and the logic class, for a game of noughts and crosses. The GUI class has a method that uses an array of JButtons and returns them all with the same anonymous inner class action listener The problem is this, when i click the button i want the text to change to an x or a o dependant ...

DLL mess in .NET, how to split one solution to multiple DLLs?

I've got a big VS.NET project with 5-6 projects and one of these projects is the Core DLL. Now to add some plugin support I extracted an interface, however interface was required to use some other classes and the Core.dll needed the interface so I had to separate them. (I can't reference to each other) After this my day ruined because ...

How to refactor tightly coupled classes?

I'm trying to refactor a big tightly coupled application and trying to make it more maintainable and flexible. I've got many unit tests, so I'm hoping to refactor step by step. Which Design & Refactoring Patterns should I consider implementing / applying to accomplish this task ? I can think of some : Extract Interface Extract Meth...

Should an object searcher method be in the a parent object, or the same as the object beign searched?

Which constitutes better object oriented design? Class User { id {get;set} } Class Office { id {get;set} List<User> Managers(){ }//search for users, return list of them } or this one Class User { id {get;set} List<User> Managers(){ }//search for users, return list of them } Class Office { id {get;set} } ...

Does GRASP Creator really decouples?

I'm learning GRASP pattern at school and I have a question about the Creator pattern. Let's say you have three class, Computer, UserRespository and User. One of the rules of the GRASP Creator pattern tells you to assign the responsibility of creating an object to the class containing those object. By following this guideline, UserRepos...

How to test anonymous classes?

I believe you must be familiar with this idiom, which is sort of java's excuse for closures //In the "Resource Manager" class public void process(Command cmd){ //Initialize ExpensiveResource resource = new ExpensiveResource(); //Use cmd.execute(resource); //Release / Close resource.close(); } //In the Client class... manage...

Does the concept of coupling two different items of data by storing them in a single variable have a name?

For example, if I have a 64-bit variable and store two 32-bit items of data in it, perhaps for the purposes of SIMD processing, is there a name to describe the logical coupling of those two items of data? A colleague of mine suggests "Hybrid Coupling", is this a widely used term? To clarify: we're after a higher level concept than spe...