For every component we have to define a well defined single purpose. Such type of components are said to be followed high “cohesion”.


If we define a single servlet for all required functionalities of mail application like displaying login page, Validating the user, Displaying Inbox page etc

Then for every small change entire component will be disturbed and it reduces maintainability and suppresses re-usability of code.

To resolve this problem. For every task we can define a separate component like login.jsp for displaying login page, validate servlet for validation purpose, inbox servlet, For displaying mails etc

By using this approach we can perform the modification in any component with out effecting the remaining and it improves maintainability. It also promotes re-usability. When ever validation required the same validate servlet we can use.

The main advantages of High Cohesion are:

  1. It improves maintainability.
  2. Enhancements is easy.
  3. Promotes reusability.

Scroll to top