Sunday, October 22, 2006

Loose coupling

[Time: 4:32 mins]

Loose (or low) coupling means (in a generic sense) that an entity can interact with another entity without being concerned with the internal implementation, and through a stable interface. Low coupling is implemented by using principles of information hiding. When two entities are loosely coupled, internal changes in one of them do not affect the other. The calling method is coupled to the called method and not it's implementation. Since we have already discussed encapsulation and information hiding in detail, I will not repeat it here.

  • Loose coupling is achieved with information hiding
  • And by programming to the interface rather than the implementation


Example 1: Tightly coupled system 

public void aMethod() { 

    ArrayList myList = new ArrayList();


private void doSomethingWithList(ArrayList list) {

Example 2: Loosely coupled system 

public void aMethod() { 

myList = new ArrayList();


private void doSomethingWithList(List list) {

  • Loose coupling contains the scope of change when an implementation is modified 

Note: This post was originally posted on my blog at

No comments: