.NET and Java J2ee Design pattern interview question :- What is the difference between Decorator and Adapter pattern?

 Posted by articlesmaint on 3/23/2011 | Category: .NET Framework Interview questions | Views: 2053

Below is the main difference between these two design patterns.

Decorator Design pattern

Used to deal with new behavior or responsibilities without affecting existing code.
Provides a wrapper over objects to apply same method which yields different results based on whether the object invoked is granular or composite.
Change of interface does not happen.
Adapter Design pattern

Mainly involved in converting interfaces as per the requirement of client
Allows use of new libraries without changing existing methods
Change of interface happens in this case


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response