Monday, June 27, 2005

Tapestry: opinion on page property specifications

I think it is *bad* practice to define page properties with explicit initial-values. The main qualification for this statement is based upon the premise that the page implements PageBeginRender. I oppose defining explicit initial-values (other than new HashMap(), new HashSet() etc.) because it's unclear to the maintainer how/why certain variables are being set and requires two files open, rather than the one java file, to ascertain page state. In order to be really readable and maintainable the coder should define an initial setup method and then invoke that upon first page load. Thus providing logical class definition (since it *is* part of the object and now resides in its guts) and clear code documentation.

No comments: