I think Sam has it right: it depends.
In my development, I never write page files -- but we don't have any
separate person devoted to the page design. That seems like the only
compelling case left for the page files, but it is somewhat
compelling: it keeps as much as possible out of the page file, so the
designed can focus on the HTML and not have to tiptoe over so much
extra baggage.
( can of course use annotations to achieve that, too, but it
requires declaring tons of getXyzComponent() methods that clutter up
classes.)
However, without the separate designed role, I find the annotations
approach keeps things much cleaner. Unless you're keen on keeping the
templates as pared-down as possible, then, I'd recommend that.
In Tap 5, it sounds like things are moving towards annotations only.
Hopefully 5 will reduce the verbosity of some of the common cases.
Cheers,
Paul
May 10, 2006, at 7:49 AM, Sam Gendler wrote:
5/10/06, Martijn Hinten <martijn.hinten (AT) cumquat (DOT) nlwrote:
>I have been wondering this for some time now: Is it the general
>consensus
>to get rid of .page files and do all binding in the html (and
>injection via
>annotations in the java classes)?
>>
>
I think it depends on the size of your team and complexity of your
app. With a fairly large team, including one person devoted to
layout, I prefer to keep all component declarations in .page files, so
that the layout templates are as clean as possible and least likely to
get screwed up by someone making edits without a clue about how
tapestry works. I've generally got nothing but jwcid attributes in my
templates. A simple macro in just about any editor will make it easy
to switch between .page and .html files in a single keystroke or mouse
click, so the complaint about having to switch files really isn't
valid, to my mind.
We also attempt to keep components in the same order in the .page file
as they are used in the .html template. It is a couple of minutes of
developer time per page at the end of any release cycle on any pages
that have gotten out of whack and it keeps things easy to find. In
fact, I have a macro in vim which will switch to a .page file and go
to the same location as I am currently at, as a percentage of the file
length, with two keystrokes. are usually good that I can see the
component that I am looking for as soon as the other file is visible,
and both files are so much more readable as a result.
The only thing I hate is when informal parameters are important to the
function of the component, since, as far as I know, they must appear
in the html file. I really wish there were a way to bind informal
parameters to a component from within a .page file, overriding any
informal parameters of the same name that are in the .html template
which may be necessary for layout in the unrendered page. That way, I
could put ALL of my parameter bindings in the .page file.
To unsubscribe, e-mail: users-unsubscribe (AT) tapestry (DOT) apache.org
For additional commands, e-mail: users-help (AT) tapestry (DOT) apache.org
--
Piano music podcast: http://inthehands.com
interesting stuff: http://innig.net
To unsubscribe, e-mail: users-unsubscribe (AT) tapestry (DOT) apache.org
For additional commands, e-mail: users-help (AT) tapestry (DOT) apache.org