[Javascript] Best Practices

Triche Osborne wdlists at triche-osborne.com
Mon Apr 17 09:09:06 CDT 2006


Mike Dougherty wrote:
>   I would recommend the hidden HTML Template. . . . 
 > You may move on to another project and will
> leave the form maintenance for a junior developer (or "FrontPage" 
> webmaster)  If the form is ever updated with an extra field, the 
> template clone method will automatically support the new element.  If 
> you are using 'from scratch' DOM insertion for each element of the 
> current form, you will likely be called back to this project to add 
> support for the new field in the js code.

A reasonable consideration, but as the entire form is being generated
from a server-side abstraction layer, any changes to it would require my
intervention anyway. (I freelance, so there are no junior developers, 
I'm afraid.) Still . . .

>   Overall, the template-clone strategy is more readable and that has 
> been (imo) a long-term win which trumps many other influences on the 
> implementation decision.
> 

The template-clone strategy was the one I followed in developing a
prototype, mainly because I was in a time-crunchm and it
seemed the quicker method. About half-way through the prototype
development, however, I began second-guessing the decision and wanted to 
get other input. Although I couldn't think of any argument against it at 
the time, I didn't want to do it only because it was quicker in the 
short run.

Triche




More information about the Javascript mailing list