Using Private methods in JSP
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sonal_Ladda
Posted On:   Monday, August 12, 2002 12:17 AM

Is it a good programming practice to use private methods in JSP

Re: Using Private methods in JSP

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, August 12, 2002 07:38 AM

In general I've always heard and read and thought that you want to make things as "private as possible", and only grant access on a "need to know basis". That way you improve the quality of your design, by reducing unwanted/unneeded "coupling" (where two separate things are mistakenly/unnecessarily dependent on each other's internal design) and instead increase "cohesion" (where two separate things work together well/correctly/robustly, even if one or the other has some internal changes).

Re: Using Private methods in JSP

Posted By:   Ivo_Limmen  
Posted On:   Monday, August 12, 2002 12:46 AM

It doesn't really matter if you use a private, protected or a public method. When your class is compiled into a servlet and it works is't ok. The visibility of methods inside a servlet does not compromise the security of your web application. On youre local machine you could only use the method and call them if you use the compiled classes directly and since they are compiled the name of that class if hard to find because it depends on the JSP engine that is used.
But if it is common practice? I do not know. As I explained above; if it works then it doesn't really matter.
A purist would say that it would have to be private, since the method is only being used by this specific JSP.
About | Sitemap | Contact