Well well.... here is my first tutorial. Hope you like my style. Any suggestions for improvements and questions regarding the tut matter would be appreciated.

So anyway getting back to the main theme....

What is coupling?
Let me give you an example....
As you read this, the palm of one of ur hands is on the mouse.
Now no 2 palms of 2 different people are exactly, completly the same.
Some are bigger, some are smaller, some are thinner , some fatter, etc.....

Now imagine if the company which made the mouse made it so that it could fit only the palm of your hands and noone elses. Then the mouse is tighly coupled to your palm.
Noone else can use it cause it fits only your palm. So the company made the mouse in such a way so that it fits everybody's palms and everyone can use it. The mouse is loosely coupled to your palms. :)

I hope you are beginning to get the idea now. Coupling in a sense means how much one object is dependent on another.

Another example is that of XML....

Why is XML is popular? One of the reasons for it is its separation of content from its presentation. To make this more clear......
When you read a book, you see its content (the text matter) along with the presentation of the text (the formatting- paragraphs, bold words, underlines, etc).
Now in a book the content is highly tied or coupled to its presentation. You cant just take the contents out of the book and format them differently in Ms Word.

But with xml, you can put the entire content of the book in an xml file, eg-

<para>first para</para>
<para>2nd para</para>
Now you can run this xml file through a parser and output this text neatly on ms word and format it or publish it on a web page or print it out neatly on paper.
Now the content has low coupling to the presentation :)

It is always desirable for the objects to be loosely coupled to each other, cause then you can change them more and it allows for great flexibility and higher resuability.

Your questions are most welcome :)
Posted on 2003-08-24 15:53:40 by clippy
Two things tightly coupled are said to have much cohesion. An object with loose coupling to other objects is said to have a high degree of containment. Containment is inversely proportional to coupling.
Posted on 2003-08-24 20:17:35 by bitRAKE
Did i forgot to mention that comments on the tutorial will be appreciated?
Posted on 2003-08-25 04:52:49 by clippy