High Cohesion and Low Coupling in C++

A

alasham.said

Q How to get High Cohesion and Low Coupling, while designing  in C++ ?

Hello,

I believe a complete reply to the above question would require a small
essay. I think therefore that it would be more appropriate for you to
go through some reference material, and then, if needed,ask specific
questions - such as: 'how to reduce local coupling - when one module
modifies or relies on the internal workings of another module'.

http://en.wikipedia.org/wiki/Coupling_(computer_science)
http://en.wikipedia.org/wiki/Cohesion_(computer_science)
http://www.aui.ma/personal/~H.Kabaili/Publications/csmr-2001.pdf

Regards.
A.S.
 
P

Phlip

Alf said:
* Pallav singh:

Be intelligent.

Or just use Test Driven Development. Tests work better when their targets are
easy to set-up. They make decoupling more convenient.
 
P

Phlip

use OO. Refactor mercilessly. Read Constantine and Yourdon.

Note that "refactor" means to run all unit tests between each tiny change. Any
other definition for it is just "churn" or "rework".
 
A

alasham.said

Does it say "coupling means to change A you must also change B"?

Yes, four lines below the main title.
Does it say "A and B share legitimate reasons to change, together"?

Actually no. It is more concerned with responsibilities of a single
module of code, I believe along the line that 'each module should do
one main thing and do it well'.
Defining those words in terms of change makes their definitions simple and
obvious, but WikiPedia probably cites sources who just go the long route....

Who knows? The OP could be a student studying the theory or a
practitioner looking for best practice, but you may be right.

Regards,
A.S.
 
P

Phlip

Yes, four lines below the main title.

Confucius say, when you go to flame WikiPedia, first dig two graves. (-:
Actually no. It is more concerned with responsibilities of a single
module of code, I believe along the line that 'each module should do
one main thing and do it well'.

I didn't say A and B were different modules. Yet the Single Responsibility
Principle is indeed more specific than "cohere"...
 
J

Jorgen Grahn

Q How to get High Cohesion and Low Coupling, while designing in C++ ?

When you have found out how, also consider if you *need* them in the
specific case. In my opinion, C++ programmers (at least in the past)
have spent too much effort in this area.

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top