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...
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...
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 ...
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...
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...
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...
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...
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
...
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...
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.
...
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...
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 ...
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?
...
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 () ...
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...
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...
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...
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...
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...
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...