wood burning stoves 2.0*
The moose likes Agile and Other Processes and the fly likes what is coupling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "what is coupling" Watch "what is coupling" New topic
Author

what is coupling

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In a recent job interview for position of junior developer this was one of the questions-
what do the terms "coupling" and "cohesion" mean?
I had no idea.
Can anybody help?

Rajesh Hegde
Ranch Hand

Joined: Sep 15, 2000
Posts: 112
Coupling and coehesion are term used in the design of software modules.
Coupling - is the degree of interaction b/w the different modules in the s/w. (inter- modular)
Cohesion- is the degree of interaction(binding) b/w parts of the same module.(intra-modular).

Good s/w design practice saus that the coupling should be minimum and cohesion must be maximum.
(ps- correct me is i am wrong in this regard).
Hope thats helps.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
I am moving this to the Process forum.
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
David Roberts
Ranch Hand

Joined: Nov 03, 2000
Posts: 142
Good stuff, I have a few questions for you
Rajesh to help me understand.
So is coupling as simple as an object holds a reference to another object?
I can see that there might be one way coupling and two way. Or is that de-coupled? For instance a Framework might know about, and execute methods on a object, but the object is decoupled, because it knows nothing of the framework.
Is that correct?
Is coupling usually a two way dependency, or do say one object is couple to another, while the other is decoupled?
I'm suprised to hear that they asked that question for a Junior Developer pos... I know guys who claim to be Senior Developers who don't know this stuff. I bet meena is more senior then some of the seniors I know...
------------------
David Roberts, SCJP2
[This message has been edited by David Roberts (edited March 31, 2001).]


David Roberts - SCJP2,MCP
martin fowler
Author
Ranch Hand

Joined: Dec 11, 2000
Posts: 53
If you're interested in this topic, I'd take a look at the articles on OO design principles in http://www.objectmentor.com/publications/articlesBySubject.html

author of:<br /><a href="http://www.amazon.com/exec/obidos/ASIN/0201485672/electricporkchop" target="_blank" rel="nofollow">Refactoring : Improving the Design of Existing Code</a><br /><a href="http://www.amazon.com/exec/obidos/ASIN/020165783X/electricporkchop" target="_blank" rel="nofollow">UML Distilled, Second Edition: A Brief Guide to the Standard Object Modeling Language</a><br /><a href="http://www.amazon.com/exec/obidos/ASIN/0201895420/electricporkchop" target="_blank" rel="nofollow">Analysis Patterns : Reusable Object Models</a><br /><a href="http://www.amazon.com/exec/obidos/ASIN/0201710919/electricporkchop" target="_blank" rel="nofollow">Planning Extreme Programming</a>
Jack Blassingame
Greenhorn

Joined: Apr 04, 2001
Posts: 7
For a real good discussion of coupling and cohesion I would read a book called Code Complete. It talks about the various types of coupling (data, time, etc.) and why they are bad. Basically coupling has to do with the concepts that are the oppositie of encapsulation. Modules that have knowledge of each others data, Modules that must be executed in a certain sequence are a couple of examples of coupling.
 
 
subject: what is coupling