decoupling

Dependency Injection and .NET Attributes

I have a couple of method attributes which do some logging. Our logging code sits behind an interface (ILog) and I'd like it if the attributes were only dependent upon that interface as opposed to an implementation. This isn't really about testability or dependency inversion so much as it is about keeping the coupling of components clean...

Defining name strings for NSNotification usage without coupling

I'm going to be using NSNotifications in my app to decouple the code. I want the compiler to help me when using strings as the names of the notifications, ie, if I mistype one, I want the compiler to tell me. Using normal strings for this won't work, because the compiler won't know that if I typed "myNotificaion" that I really meant "m...

Advice writing Losely Coupled code with Agile methods or otherwise

I have been reading Robert C. Martin's (aka Uncle Bob) books very intensely as of late. I have found a lot of the things he talks about to be real life savers for me (small function size, very descriptive names for things, etc). The one problem I haven't gotten past yet is code coupling. One problem I keep having over and over is that ...

Should logging reside within a class who's primary purpose is not logging?

This is more of a theoretical question. Should logging reside within a class who's primary purpose is not logging? Here is a simple interface for anything that will preform a calculation on a number. public interface ICalculation { public int calculate(int number); } Here is an implementation of the ICalculation interface that...

decoupling django apps - best practice to layout a project

I'm working on a project that has several apps, and want to include a news app for news stories. However, I'd like to link news stories to objects in my custom app, but use an open source news app to run the news. At the moment I've simply hacked the chosen news app to add in a ForeignKey relationship with my model. i.e. a widgets app...

Decoupling django apps 2 - how to get object information from a slug in the URL

I am trying to de-couple two apps: Locations - app containing details about some location (town, country, place etc) Directory - app containing details of places of interest (shop, railway station, pub, etc) - all categorised. Both locations.Location and directory.Item contain lat/lng coords and I can find items within a certain dist...

Does using a C++ namespace increase coupling?

I understand that a C++ library should use a namespace to avoid name collisions, but since I already have to: #include the correct header (or forward declare the classes I intend to use) Use those classes by name Don't these two parameters infer the same information conveyed by a namespace. Using a namespace now introduces a third p...

Help decoupling Crystal Report from CrystalReportViewer

I'm using Visual Studio 2005 with VB.NET. I have a number of Crystal Reports, each with their own associated dialog resource containing a CrystalReportViewer. The class definitions look like this: Imports System.Windows.Forms Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class dlgForMyReport ...

Book/tutorial that teaches how to make programs that are easy to maintain and are less coupled?

Hi, I'm a PHP programmer and I really want to increase the quality of my code and most importantly I want to be better at programming. What book, tutorial or article would you guys suggest that I read that teaches how to make programs that are less coupled and easy to maintain? Are there any specific tips for PHP especially for the Cake...

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. ...

Dependency Injection and decoupling of software layers

I am trying to implement Dependency Injection to make my app tester friendly. I have a rather basic doubt. Data layer uses SqlConnection object to connect to a SQL server database. SqlConnection object is a dependency for data access layer. In accordance with the laws of dependency injection, we must not new() dependent objects, but ra...

TDD with Web Config

All great stories they always start with those 4 magical words... I have inherited a system... no wait! that isn't right! Anyway with my attempt at humour now passed I have not so much been given more I have to support an existing service. There are many many issues when it comes to using this service, as an example one is to create a ...

What is the golden rule for when to split code up into functions?

It's good to split code up into functions and classes for modularity / decoupling, but if you do it too much, you get really fragmented code which is also not good. What is the golden rule for when to split code up into functions? ...

How do I unit-test a class that depends on another class to change the state of something?

I have a class A which contains an instance of class B, and function foo of A calls function set of B, which updates the state of B. Here is a code example (in Javascript): A = function () { this.init = function (b) { this.b = b } this.foo = function (val) { this.b.set(val) } this.bar = function () ...

Will decoupling be beneficial in a redesign of a legacy application?

I am working on a company running several internet shops. We are about completely rewrite the whole code: site content and products management, order processing, partner relations, accounting, customer base and other. Currently we have a system, where all the stuff (all internal management sites, business-logic and internet store web sit...

Decoupling - OOP

Hi, I have a simple question (working with Java). I have two classes, one represents a Document, a second represents a Word. The Document class needs to know some info about the words that is kept in Word. My question is, what's the best way to decouple the two classes? I have 2 options in mind: Have no connection between the classes...

How to design a program so the GUI and program logic are decoupled

I'm starting to make my first C program in awhile using GTK+. I've learned C to some extent and I've worked with PyGTK, so I have a decent understanding of both. But, I've never created GUI program with C. Though it worked, my last GUI program was a bit of a mess because the program logic was all mixed in with the GUI stuff. I've read t...

Reverse dependency between layers problem

I'm building a control system for a hardware installation (water circulation system). I've designed it in two layers: the hardware description layer and the control layer. +----------------------------------------------+ | Control (enables manipulation of devices) | +----------------------------------------------+ | uses (de...

Increasing the number of Models on Google App Engine affects performance?

I made a Google App Engine application as a class project in my university. Now I need to optimize it to use it commercially. Nowadays, the code is very slow. It has only few Models with many properties in each. Before rewriting the Models code, I need to know if my application will be faster if I increase the number of Models, i.e. inc...

Trouble applying the mediator pattern in ASP.NET C# with generic List datasources

I'm working on a large ASP.NET project with a CMS driving lots of data. We have lots of modular components on our pages defined as ASCX controls. Several of these controls need to know about each other to know what data to get from the CMS (i.e. if there's a list of articles in one control, another similar control on the same page cannot...