1 – If two different classloaders load a singleton class, would they load it twice ?
Two objects loaded by different class loaders are never equal even if they carry the same values.
So, each class loader will have its own singleton.
2 – What is Decorator design pattern ?
The decorator design pattern attaches responsibilities to objects at runtime.
BufferedInputStream in java.io is an example of Decorator. It wraps around a InputStream and provide additional buffering functionality.
3 – What is Strategy design pattern ?
Strategy design pattern lets you swap new algorithms and processes into your program without
affecting the objects that use them.
AWT containers delegate the layout to layout managers. Layout managers use strategy pattern to for appropriate layout.
4 – What is Iterator Design pattern ?
Iterator pattern is used to iterate over a collection sequentially and provide a way the access the individual elements.
5 – What is Factory pattern ?
Factory pattern abstracts the object creation process from the code that uses the objects.
6 – What is Front Controller design pattern ?
Front controller suggest using a single servlet for centralizing request handling and delegating functions like validation and business process handling to helpers.
7 – What is Composite view pattern ?
A composite view is made of several sub-views.
A JSP page can use a header jsp, footer jsp etc.
8 – What is View Helper pattern ?
In this pattern, the view delegates processing responsibilities to helper classes.
Implemented using Javabeans.
9 – Difference between Service to Worker pattern and Dispatcher View pattern.
Both pattern use Front controller combined with Helpers with Dispatcher component.
In Service to worker, front controller delegates content retrieval to View Helpers. Controller also takes care of tasks like authentication, authorization etc.
In Dispatcher View, Controller does not delegate content retrieval to helpers. Most of the work is done by views.
© 2015 – 2016, https:. All rights reserved. On republishing this post, you must provide link to original post
#