Fog Creek Software
Discussion Board




Coupling and Cohesion

Does anybody know who came up with these terms?  Do many of you still you them in practice?  I remember learning the terms at University in about 1994, but I don't know with them.  My guess is Niklaus Wirth. 

christopher baus (www.baus.net)
Wednesday, May 12, 2004

That should read "I don't know WHO came up with them."

christopher baus (www.baus.net)
Wednesday, May 12, 2004

At a very hazy guess Yourdon, though you could be right about Wirth.  There's a reference to it in 

Yourdon and Constantine (1979). Yourdon E., Constantine L.L. Structured design - fundamentals of a discipline of computer program and systems design. Prentice Hall, Englewood Cliffs, New Jersey.

Note at this point its in relation to structured programming.

Simon Lucy
Wednesday, May 12, 2004

Out of curiosity what could be said about the coupling between a and b in the following in C++ code. 

template <class T>
class a{
private:
T foo_;
};

template <class T>
class b{
private:
a<T> bar_;
};

No this isn't an interview question or homework problem.  ; )  This is something that is banging around in my head.  I don't want to lead anyone toward an answer, so that's all I'll say for now.

christopher baus (www.baus.net)
Wednesday, May 12, 2004

"template <class T>
class a{
private:
T foo_;
};

template <class T>
class b{
private:
a<T> bar_;
};"

a is part of b.

E.g., if you create an instance of b<int>, b will have an a<int>.

As far as coupling is concerned, they're associated by composition, IIRC.

What else?

Paulo Caetano
Wednesday, May 12, 2004

The Yourdon/Constantine book was a required text for my software engineering class, and it has a (long+involved) chapter each for coupling and cohesion.  Maybe two chapters for coupling.

I'd definitely recommend the book if you're looking into these topics.

pds
Wednesday, May 12, 2004

I'll see if we have the Yourdan book in our library.  My feeling is that the propagation of template parameters increases coupling between a and b, but Coupling doesn't really talk about template paramters.  In C++ this is only way to parameterize b in respect to a.  I think this is bad, as a change to a parameters requires a change to b. 

This is a common problem when aggregating Policy classes in C++.

christopher baus (www.baus.net)
Wednesday, May 12, 2004

*  Recent Topics

*  Fog Creek Home