Kiss My App

Tuesday, November 23, 2004

The Annotated Dream

IMHO, the most prominent feature in J2SE5 is not generics, enums, or new for loops; it's annotations.

Annotations are better than Aspects since they are explicitly declared on your methods/fields/classes and checked by the default compiler. You may argue that Aspects and annotations aren't the same thing, but I believe Aspects are there to provide additional behavior within a specific context or protocol-- where now that context/protocol can simply leverage annotations declared on your objects. An example is a persistence protocol. Either you write Aspects and pointcut all of your objects to provide additional behavior/properties for persistence, or simply have your persistence mechanism "read" the behavior/properties off of the object you pass it.

I would like to see JavaServerFaces annotated just like EJB 3.0. The annotations wouldn't be a substitution to in-page declarations, but as a secondary solution for those who want a cleaner seperation of validation/conversion rules from the view. Imagine declaring a POJO bean with some JSF validation annotations and some EJB annotations. How easy would it be to modify and persist objects from a web page?

2 Comments:

  • You cannot compare Annotations and Aspects. Annotations are static metadata (even from a compiler perspective).

    JBoss provides an EJB 3 implementation which is build on top of AOP. If you don't like AOP, but still likes Annotated programs, AOP is an implementation detail for you then.

    By Anonymous Anonymous, at 7:51 AM  

  • ... hence the second paragraph I state why I can compare them in what they provide, not how they provide.

    By Blogger Jacob Hookom, at 3:32 PM  

Post a Comment

<< Home