Tagonist

Jeff Schnitzer <[email protected]> Wed, 06 Jul 2005 17:09:44 -0700
Newsgroups gmane.comp.web.maverick.general
Message-ID <[email protected]>
Hi everyone.  All has been pretty quiet on the Maverick front for quite 
a while, but that's not surprising - Maverick is pretty much "done".  
However, over the last couple years I kept bumping into shortcomings of 
the servlet-front-controller approach taken by Maverick, Struts, 
WebWork, and friends.  Specifically:

* It's hard to build portals or otherwise compose pages from smaller 
bits of component functionality.
* You tend to evolve towards one Controller/Action class per screen.  
Controllers rarely get reused.
* If you have more than a couple web developers, they bump into each 
other when editing the xml sitemap config file.
* Explaining the xml sitemap config file to nonprogrammers is unpleasant.

So I started tinkering.

I started out trying to turn Maverick inside-out by creating a custom 
JSP tag that would instantiate Maverick controllers ad-hoc from within 
JSP files.  It worked reasonably well and allowed you to instantiate 
multiple controllers on a page, thus allowing each individual controller 
to have finer functional granularity.  Pages which required form 
processing went through the standard MVC pattern, but pages which just 
render data (ie most pages in most webapps) merely require a standard 
JSP with a few invocations of a custom tag - you could add pages without 
touching maverick.xml.

Still, the model wasn't a perfect fit - abusing the Maverick APIs like 
this felt clunky.  So I tinkered some more.

I ultimated ended up starting from scratch, creating Tagonist.  Tagonist 
is a *lot* simpler than Maverick.  It's necessarily JSP-only, so you 
can't use Velocity or XSLT.  It doesn't (by itself) handle document 
transformations.  It doesn't have any special switching logic for 
internationalization.

What Tagonist provides is the basic MVC glue in a very compact package:

* No servlets required.  All your URLs point to plain old JSPs.
* No sitemap configuration, XML or otherwise.  In fact, there are no 
config files whatsoever.
* You can build fine-grained Action classes and compose them arbitrarily 
on a page.
* You can use Tagonist on any JSP page, even if the page is already part 
of some other framework, be it Maverick, Struts or some fancy portal 
application.  There are no integration issues.
* Tagonist is, I kid you not, less than 500 lines of code (including 
whitespace!).  The tagonist jar is 8k.

If this sparks your curiosity, look at http://tagonist.tigris.org/

I've been using Tagonist in production for about four months and I'm 
happy enough with the results that I've released the 1.0 version.  The 
tagonist distribution includes a port of the same Friendbook application 
that Maverick comes with, but if you'd like to see a live tagonist app, 
check out http://www.similarity.net.

To anticipate some questions...

Does this mean I am abandoning support for Maverick?  No.  But Maverick 
hasn't needed any updates in quite some time, and I do all my web 
development with Tagonist these days.

What about Velocity?  I love Velocity and I still use it for templating 
everything except web pages.  However, JSP has advanced considerably in 
the last few years.  The JSP2.0 expression language and JSTL incorporate 
most of what made Velocity special, and new features like .tag files are 
superior in most respects to Velocity macros.

What about transforms?  If you need the fancier transformations like 
XSLT, FOP, or the like, Maverick is great.  However, if all you need are 
Document transforms, JSP2.0 custom tags (ie .tag files) are better both 
from an ease-of-use and performance perspective.  Compare the Tagonist 
Friendbook with the Maverick Friendbook to see what I mean.

Thanks,
Jeff Schnitzer
Voodoodyne Inc.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
[INVALID FOOTER]