static constant and performance
Hi,
We are having a web application. being a web application everyone knows that it is multithreaded. For each and every request n number of string constants will be created. whether is it a right way to put all those string constants in a class and access it in the other classes. For example, I have a class named FieldConstants which will have n number of constant variable(possibly around 5000)
public Class FieldConstants{
public static final String EMP_NAME = "Employe Name";
public static final String EMP_CODE = "Employe Code";
.
.
.
}
public class EmployeeDetails{
public List getEmployee(){
ResultSet rs ;
List employeeList = new ArrayList();
.
.
rs = pstmt.executeQuery();
while(rs.next()){
employeeList.add(FieldNameConstants.EMP_NAME);
}
return employeeList;
}
This is just a sample. Generally using this concept, nothing will be directly hard coded in the code rather it will come from the class FieldConstants class in the entire application.
Whether will it boost the performance if yes then how? There is no doubt that it will be a big problem when we go for debugging the code. One of my collegue suggests this idea. Your valuable suggestions are required.
Regards
Felix