I have one design question, which I am really confused about. The application that I am working on is really dynamic so the html is never coded in the jsp, its always build by the specific builders. For eg for different html types I have different html builders, for text i have a texthtmlbuilder class, for label i have a labelhtmlbuilder class, etc. All these builders generate the html based on one object 'Field' that is passed to them which has all the specifications. for eg this object called field will have getters etc for height, width, etc which the builders will be using to generate the html.
All the builders extend one base class which has implementation for methods that is common to all other builders. Every builder has a gethtml method which has its own specific implementation.
In the present implementation I am always creating a new object of the builder based on the type of the 'Field' object. No builder has any class level variables, everything is done based on this 'Field' object passed to the gethtml method of every builder.
The question is should these builders be singletons ? If yes, then all the gethtml methods I guess would need to be synchronized - wont this impact performance ?