Design patterns options in EPractice Lab mock exam 1
posted 7 months ago
In EPractice Lab mock exam 1:
17. A developer has created a web application that includes a servlet for each use case in the application. These servlets have become rather difficult to maintain because the request processing methods have become very large. There is also common processing code in many servlets because these use cases are very similar. Which two design patterns can be used together to refactor and simplify this web application?
B. View Helper
C. Front Controller
D. Session Facade
E. Business Delegate
The given answers are C and F.
The front controller pattern is a software design pattern listed in several pattern catalogs. The pattern relates to the design of web applications. It "provides a centralized entry point for handling requests." The MVC pattern separates the modeling of the domain, the presentation, and the actions based on user input into 3 separate classes:
Model: the model manages the behavior and the data of the application domain, responds to requests for information about its state (usually from the view) and responds to instructions to change state(usually from the controller).
View: the view manages the display of information.
Controller:the controller interprets the mouse and keyboard inputs from the user, informing the model and / or the view to change as appropriate.
I think the answers are C and E instead.
Since the serlvets are difficult to maintain and request processing methods are large, we can use a business delegate to delegate the implementations of request processing to the business logic layer.