41.is Visitor pattern?
In Visitor pattern, we use a visitor class which changes the executing algorithm of an element class. By this way, execution algorithm of element can vary as and when visitor varies. This pattern comes under behavior pattern category. As per the pattern, element object has to accept the visitor object so that visitor object handles the operation on the element object.
42.What is MVC pattern?
MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate application’s concerns.
Model – Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.
View – View represents the visualization of the data that model contains.
Controller – Controller acts on both model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps view and model separate.
43.What is Business Delegate pattern?
Business Delegate Pattern is used to decouple presentation tier and business tier. It is basically use to reduce communication or remote lookup functionality to business tier code in presentation tier code. In business tier we have following entities.
Client – Presentation tier code may be JSP, servlet or UI java code.
Business Delegate – A single entry point class for client entities to provide access to Business Service methods.
LookUp Service – Lookup service object is responsible to get relative business implementation and provide business object access to business delegate object.
Business Service – Business Service interface. Concrete classes implement this business service to provide actual business implementation logic.
44.What is Composite Entity pattern?
Composite Entity pattern is used in EJB persistence mechanism. A Composite entity is an EJB entity bean which represents a graph of objects. When a composite entity is updated, internally dependent objects beans get updated automatically as being managed by EJB entity bean. Following are the participants in Composite Entity Bean.
Composite Entity – It is primary entity bean. It can be coarse grained or can contain a coarse grained object to be used for persistence purpose.
Coarse-Grained Object – This object contains dependent objects. It has its own life cycle and also manages life cycle of dependent objects.
Dependent Object – Dependent object is an object which depends on coarse grained object for its persistence lifecycle.
Strategies – Strategies represents how to implement a Composite Entity.
45.What is Data Access Object Pattern(DAO) pattern?
Data Access Object Pattern or DAO pattern is used to separate low level data accessing API or operations from high level business services. Following are the participants in Data Access Object Pattern.
Data Access Object Interface – This interface defines the standard operations to be performed on a model object(s).
Data Access Object concrete class – This class implements above interface. This class is responsible to get data from a data source which can be database / xml or any other storage mechanism.
Model Object or Value Object – This object is simple POJO containing get/set methods to store data retrieved using DAO class.
46.What is Front Controller pattern?
The front controller design pattern is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler. This handler can do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers. Following are the entities of this type of design pattern.
Front Controller – Single handler for all kinds of requests coming to the application (either web based/ desktop based).
Dispatcher – Front Controller may use a dispatcher object which can dispatch the request to corresponding specific handler.
View – Views are the object for which the requests are made.
47.What is Intercepting Filter pattern?
The intercepting filter design pattern is used when we want to do some pre-processing / post-processing with request or response of the application. Filters are defined and applied on the request before passing the request to actual target application. Filters can do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers.
48.What are the entities of Intercepting Filter pattern?
Following are the entities of this type of design pattern.
Filter – Filter which will performs certain task prior or after execution of request by request handler.
Filter Chain – Filter Chain carries multiple filters and help to execute them in defined order on target.
Target – Target object is the request handler.
Filter Manager – Filter Manager manages the filters and Filter Chain.
Client – Client is the object who sends request to the Target object.
49.What is Service Locator pattern?
The service locator design pattern is used when we want to locate various services using JNDI lookup. Considering high cost of looking up JNDI for a service, Service Locator pattern makes use of caching technique. For the first time a service is required, Service Locator looks up in JNDI and caches the service object. Further lookup or same service via Service Locator is done in its cache which improves the performance of application to great extent.
50.What is Transfer Object pattern?
The Transfer Object pattern is used when we want to pass data with multiple attributes in one shot from client to server. Transfer object is also known as Value Object. Transfer Object is a simple POJO class having getter/setter methods and is serializable so that it can be transferred over the network. It does not have any behavior. Server Side business class normally fetches data from the database and fills the POJO and send it to the client or pass it by value. For client, transfer object is read-only. Client can create its own transfer object and pass it to server to update values in database in one shot. Following are the entities of this type of design pattern.
Business Object – Business Service fills the Transfer Object with data.
Transfer Object – Simple POJO having methods to set/get attributes only.
Client – Client either requests or sends the Transfer Object to Business Object.