Decorator and Adapter.
|Used to deal with new behavior or responsibilities without affecting existing code||Mainly involved in converting interfaces as per the requirement of client|
|Provides a wrapper over objects to apply same method which yields different results based on whether the object invoked is granular or composite||Allows use of new libraries without changing existing methods|
|Change of interface does not happen||Change of interface happens in this case|
Template and Strategy.
|Defines outline for algorithms and allows sub class to override some steps||Uses object composition to provide variety of algorithm implementation|
|Efficient in terms of less redundant code||Flexible in terms of allowing users to change algorithm at run time|
|Depends on super class for methods||All the algorithms can be itself implemented|
Factory and Abstract Factory.
|Specifies creation method which will be used by sub class for object creation||Used to create group of related objects while hiding actual classes|
|Deals with single product||Deals with number of products|
|Each concrete factory implements abstract factory in case more than one products needed to be supported||Makes uses of factory pattern provided by each family of product|
See the following JAVA / J2EE/ Core Java video on get started with Apache CXF.
Also visit our site from more such Java / J2EE/ Core Java interview question with answers videos.