Coupling
m (created coupling page) |
m |
||
Line 4: | Line 4: | ||
Strong coupling occurs when a dependent class contains a pointer directly to a concrete class which provides the required behavior. Loose coupling occurs when the dependent class contains a pointer only to an interface, which can then be implemented by one or many concrete classes. Loose coupling provides extensibility to your design. You can easily add a new concrete class later that implements that same interface without ever having to modify and recompile the dependent class. Strong coupling does not allow this. | Strong coupling occurs when a dependent class contains a pointer directly to a concrete class which provides the required behavior. Loose coupling occurs when the dependent class contains a pointer only to an interface, which can then be implemented by one or many concrete classes. Loose coupling provides extensibility to your design. You can easily add a new concrete class later that implements that same interface without ever having to modify and recompile the dependent class. Strong coupling does not allow this. | ||
− | [User:Paul Williams] | + | [[User:Paul Williams]] |
== Other places for information on Coupling == | == Other places for information on Coupling == | ||
− | * [[http://en.wikipedia.org/wiki/Coupling_(computer_science)|Wikipedia | + | * [[http://en.wikipedia.org/wiki/Coupling_(computer_science)| Wikipedia]] |
Revision as of 21:36, 23 July 2009
Coupling
Coupling refers to the degree of direct knowledge that one class has of another. This is not meant to be interpreted as encapsulation vs. non-encapsulation. It is not a reference to one class's knowledge of another class's attributes or implementation, but rather knowledge of that other class itself.
Strong coupling occurs when a dependent class contains a pointer directly to a concrete class which provides the required behavior. Loose coupling occurs when the dependent class contains a pointer only to an interface, which can then be implemented by one or many concrete classes. Loose coupling provides extensibility to your design. You can easily add a new concrete class later that implements that same interface without ever having to modify and recompile the dependent class. Strong coupling does not allow this. User:Paul Williams