BIRT 3.7
Written by: Michael Williams
Featured Refcardz: Top Refcardz:
  1. Scrum
  2. Apache Maven 2
  3. Essential MySQL
  4. Node.js
  5. Groovy
  1. jQuery Selectors
  2. Ajax
  3. Java
  4. Spring Config.
  5. Java Concurrency

Link Details

Link 94578 thumbnail
User 214988 avatar

By puredanger
via rethrick.wordpress.com
Published: Jul 13 2008 / 19:56

We’ve all been there: fired up the next set of changes in a webapp and navigated through a complex flow, entering fake data for the n-th time only to find a massive exception on the page we’ve been expectantly working on, due to a simple typo.
  • 24
  • 3
  • 3675
  • 0

Comments

Add your comment
User 211643 avatar

zynasis replied ago:

0 votes Vote down Vote up Reply

Couldn't agree more.

User 270877 avatar

killerweb replied ago:

0 votes Vote down Vote up Reply

It's a catch 22, like with DLs. If the compiler of the template needs to know what the object structure is at compile time, either give the compiler all that information upfront, that adds lots of work to creating dynamic templates. And option 2, flight-check at runtime and throw warnings up when running, which creates performance hiccups. No one solution fits everyone, developers that want to build fast and also prototype ideas will take the complete dynamic route, other developers will take the "give it more information upfront" and let the compiler speak approach. Good article, but I think saying Web frameworks are broken for this reason is a little much. But broken because of their complexity, maybe ;)

User 270790 avatar

jmarranz replied ago:

0 votes Vote down Vote up Reply

I can’t agree more too.

This is the typical problem of “executable views” or “pull views” (the view pulls data), in the old JSP approach Java code was hard coded and the compiler was very useful to detect coding bugs. Now most of the templating engines interpret the view (the view logic uses interpreted languages) and there is no way to detect errors in a compiler phase.

The alternative is using non-executable views or web frameworks with “push views” (the application pushes any data to the view). Frameworks with “push views” reduce the view logic in the view, in some way the view rendering is “driven” by Java code, one immediate benefit is a cleaner view/view logic separation.

Terence Parr talks about this:
http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf

There are no very much examples of web frameworks with push views (pull view approach is dominant), some examples:

- StringTemplate: a proof of concept of Terence Parr ideas.
http://www.stringtemplate.org

- GWT : this is an extreme example because there is no template, view is built programmatically.
http://code.google.com/webtoolkit/

- Wicket: the template is almost pure HTML, most of the logic is defined in Java
http://wicket.apache.org

- ItsNat: my preferred, because I’m the author :) In ItsNat the view logic is pure Java using W3C DOM Java APIs and the templates is absolute pure HTML (or SVG).
http://www.itsnat.org

User 187417 avatar

sproketboy replied ago:

0 votes Vote down Vote up Reply

Yup or you can look at Jolene.

http://jolene.sourceforge.net/

It's still in it's early stages. Jolene requires no custom tags or attributes of any kind. Plain old HTML pages are used as-is. Jolene parses and returns a DOM to Java so all the expression type coding is done away with. You can everything in Java itself and get all the nice type safety.

Currently it's still in Alpha because I'm re-arranging the code and building samples apps but I've been using it for a long time. It works with files, servlets or struts 1.2/1.3. It could be used with any framework which uses JSP or Velocity.



Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.