Hello all,
I thought it might be useful for any users who have upgraded applications
from T4 to T5 to share their experiences, techniques and suggestions.
Personally, I have upgraded two small applications - the first was still in
development, and I had been wavering on whether to use T5 (back around
5.0.3) or T4, and the second was the first *real* application I ever built
with Tapestry and deployed on 4.0.1.
Here's a bit of a comparison:
Application 1 (new, Internet facing, for client-QA review of call center
audio recordings):
T4.1.3
About 5 pages
Mainly configured with annotations
HTML contained mainly jwcid's with other parameters provided
through annotations
Spring
Hibernate
Application 2 (internal, dashboard-type app):
T4.0.1
About a dozen pages
Mainly configured with .jwc and .page files
HTML cluttered with parameters
Spring
Hibernate
First off, all of my data model and persistence code went over without a
hitch. Spring configurations stayed the same.
The first application I found easy to change over. It was mainly a matter
of changing abstract methods to private instance variables and providing
getters and setters, and changing the names of methods to conform to T5 page
and form lifecycles. Templates and classes needed to be moved to conform to
package conventions, but Eclipse refactoring tools made that easy.
What was nice was that the guts of the HTML didn't have to change much -
mainly replacing jwcid with t:id.
It was tedious, and if I had massive applications to change, then automation
would be a consideration.
The second application was more of a pain, because configuration information
was scattered through jwc/page files, HTML, and java code. Many properties
were only declared in jwc/page files and these all needed to get put into
java code. I also switched from Ant to Maven.
Apart from that tedium, the biggest issue I found with this migration was
the change in my own practices, and a desire to use some of the features of
T5, like the Grid.
The T5 reloading feature really helped because so many of the changes were
piddly little things and finding them all was like playing Whack-A-Mole.
If I were a shop with a large investment in the T4.0 series, with lots of
XML-based configuration and cluttered HTML, I might want to gradually get
that configuration information moved into java annotations and code, and
even start to rename listeners to take advantage of T5 conventions when
migration time comes.
Ironically, I'm finding I now put more into the .tml files, because various
changes with T5 like expansions have trimmed down my HTML compared to T4.
I'll have to stop that and get back to leaner HTML.
The largest and most complex application I build in T4 is not one I'm
looking forward to converting. It has quite good separation, and most work
is done in annotations, but it uses a fair bit of OGNL, and has some
interesting Callback stacks. Then again, I would love to re-architect the
most challenging parts anyway.
I would be interested in hearing anyone else's experiences, and strategies
anyone has for preparing to migrate larger applications.
Jonathan