Java Reference
In-Depth Information
for invoking a session bean to carry out a distinct business function. However, this was a
most inflexible design and degraded reuse.
I will point out two simple use cases to elaborate on the problem discussed in the
previous paragraph. A claimant name can be modified until the claim is finally sanc-
tioned. Such modification involves a simple update operation on the claim record. Now
for a slightly tricky situation: consider a case when a lodged claim is rejected because of a
lack of evidence. It is easy to think of this as a delete operation. However, it had to be
handled as a soft delete by appending an effective end date to the claim record. This was
done because a rejected claim could be revived once mandatory information is available.
Moreover, it can be used as references for policies taken by the claimant in the future.
The JSP front controller had two distinct if-else blocks to cater to the two scenarios.
Two separate blocks of code were unnecessary, because the first case was an update of
the name field in the claim record, while the second case required the claim status and
effective end date fields to be modified in the same record. Thus, you have two blocks of
code where only a single block is really necessary. This is just one example of several such
blocks scattered in all the JSP controllers of eInsure. Moreover, as I have already pointed
out, JSP is not the appropriate controller to house the user action handlers. For each new
feature, a block needs to be added that discouraged OO principles—encapsulation,
inheritance, and reusability.
It is easy to consider embedding these blocks in the front controller dispatcher
servlet. However, the dispatcher servlet would soon be polluted like the JSP controller,
leaving it inflexible and unsuitable for use across applications.
• Remove the code that invokes business logic in response to user action to reusable
• Identify the reusable components based on the request URL instead of hard-coded
event and screen code.
• Deploy one reusable component per user action.
Use a page controller to consolidate user action processing.
Search WWH ::

Custom Search