I do control my crud list and detail pages with annotations on the model, and it works quite nice (although I can't say the panels constructing the data table and form belongs in the category pretty code, at least there isn't a lot of it). I find I often use multiple views of the same model objects though, and for the non-trivial views the annotations become less useful, although it's still nice to tie in validation and some of the simpler jpa annotations, using them for layout loses the point here.

Johan

Ryan Sonnek wrote:
Although it may blur the lines between view and model, there are a number of
reasons that it still could be the right direction.
* centralized configuration.  all view configuration is in the same file as
your model code.
* leverage Java syntax instead of custom DSL.  easy for users to get up and
going when they have autocomplete for annotation configuration.
* annotations are metadata, and this configuration *is* metadata for the
view layer.
* configuration by exception works well with annotations.  Hibernate applies
the same principle.  you only need to declare annotations when you want to
change the default behavior.

I do understand your disagreement.  It's a very natural "Java" architecture
to create abstractions and try to build to design patterns.  Realistically
though, there are times when it's just plain overboard.  You could make the
same argument that Hibernate annotations don't really belong in the model
code since it's configuring the back end setup, but the beauty of
annotations is that it's metadata that *any* layer has access to.  I
recently published a wicket/hibernate component that leverages the hibernate
annotations to enforce view layer behavior (requiredness/max length).  Talk
about "blurring" the lines...

I'm really impressed with your work, and just want to impart what's worked
*really* well for me.  Good luck with whatever direction you take.

On 9/16/07, Dan Syrstad <[EMAIL PROTECTED]> wrote:
Ryan:

The WWB beanprops/metadata is a view abstraction, while your bean is a
part
of the model. It's my opinion that putting view-based annotations on your
model is Not a Good Thing. It confuses the separation of concerns.

-Dan

On 9/16/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote:
For me databinder helps cut the boilerplate code, just as WWB. I just
add
annotations to my domain model, and databinder does the rest. It's WWB
for
the database side of the app! Imagine putting both working together. I
was
able to create CRUD pages with the least amount of code ever. Less
than
that
and it would need to read my mind... ;)


Annotations have been a big win for Java.  Many of their success stories
have come out of their usage for "configuration" or "metadata".  I think
that WWB may be a cantidate for using annotations instead of the
beanprops
file!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to