Design patterns interview questions2
Q9. What is Intercepting Filter pattern?
Ans. Provides a solution for pre-processing and post-processing a request. It allows us to declaratively apply filters for intercepting requests and responses. For ex. Servlet filters.
Q10. What is Front Controller pattern?
Ans. It manages and handles requests through a centralized code. This could either be through a servlet or a JSP (through a Java Bean). This Controller takes over the common processing which happens on the presentation tier. The front controller manages content retrieval, security, view management and retrieval.
Q11. What is View Helper pattern?
Ans. There generally are two parts to any application – the presentation and the business logics. The “View” is responsible for the output-view formatting whereas “Helper” component is responsible for the business logic. Helper components do content retrieval, validation and adaptation. Helper components generally use Business delegate pattern to access business classes.
Q12. What is Composite View pattern?
Ans. This pattern is used for creating aggregate presentations (views) from atomic sub-components. This architecture enables says piecing together of elementary view components which makes the presentation flexible by allowing personalization and customization.
Q13. What is Service to Worker pattern?
Ans. This is used in larger applications wherein one class is used to process the requests while the other is used to process the view part. This differentiation is done for maintainability.
Q14. What is Dispatcher View pattern?
Ans. This is similar to Service to Worker pattern except that it is used for smaller applications. In this one class is used for both request and view processing.
Q15. What is Business Delegate pattern?
Ans. This pattern is used to reduce the coupling between the presentation and business-logic tier. It provides a proxy to the façade from where one could call the business classes or DAO class. This pattern can be used with Service Locator pattern for improving performance.
Q16. What is Value Object (VO) pattern?
Ans. Value Object is a serializable object which would contain lot of atomic values. These are normal java classes which may have different constructors (to fill in the value of different data) and getter methods to get access to these data. VOs are used as a course grained call which gets lots of data in one go (this reduces remote overhead). The VO is made serializable for it to be transferred between different tiers within a single remote method invocation.