How to use helper classes...Why we need helper classes

Discussions

Web tier: servlets, JSP, Web frameworks: How to use helper classes...Why we need helper classes

  1. Hi...

        I have doubts...Is helper classes are different from java classes and how to call a helper classes from servlet and why do we need it.Please can anyone tell me

    Looking forward
    Kothai
  2. core design patterns[ Go to top ]

    see: http://java.sun.com/blueprints/corej2eepatterns/Patterns/ViewHelper.html

    Viktor
  3. Modularize logic[ Go to top ]

    I'm not entirely sure what you're asking about here. Helper classes are just a term people give to classes that are used to assist in providing some functionality, though that functionality isn't the main goal of the application. They're also used to reduce the amount of redundancy in your code. For example, reading some information from a cookie is somewhat tedious, but it's use may be common across all servlets/actions in your app. It makes sense to write a new class to handle that, so you just write one line of code in your servlet to get this other class to handle it for you.

    That's just basic programming techniques...you don't want to replicate code throughout your app. It leads to more bugs and makes your app difficult to maintain.
  4. Hi Kothai,

    Yes i agree with the previous reply !

    Helper class is a layman term being widely used in the developer community. You are right to say that a normal java class is a helper class.

    In most of the cases, helper classes are developed to make code very maintainable and reusable. ValueObjects are also nothing but helper classes.

    regards
  5. Thankyou...for all.