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