On Thu, June 8, 2006 2:46 pm, Craig McClanahan wrote:
> Always slow to get on the latest bandwagon, eh Frank :-)

Who, what, me?!?   Nnnnnaaaahhhhhh!

(hey, you were the last Ant vs. Maven holdout, I was happy I wasn't the
only one... you left me man!! LOL)

> That being said, XML configuration files are going out of fashion, at
> least
> among the developers who speak out a lot :-).

Yeah, I noticed that. :)  I'll be there in 5 years or so :)

I personally think this is the case because there are some *bad* XML
config files around.  I think when done right they are still preferable in
most cases.  However...

> Here's my two cents on when
> I
> like to use annotations, and when I don't.
>
> * Annotations are a good idea when the configuration concept is directly
>   related to how you code your source.  Examples include beans used
>   in a webapp (it really matters whether you're going to store it in
> request
>   scope or session scope or application scope), transactional settings
>   on an EJB, and so on.  Storing the actual annotation in the source code
>   reduces the chances that some sysadmin installing your application might
>   accidentally or inadvertently change the scope setting, without
> understanding
>   that they just broke your code.

Definitely fair poins... and I have to admit, looking at EJB3 as an
example, I in fact *love* annotations!  EJB's (pre-EJB3) are probably the
best example IMO of where config files can go wrong.

> * Annotations are not a good idea when the configuration concept should
>   not be a concern of the person actually writing the code.  In webapps,
> for
>   example, I don't believe in configuring page navigation rules (Struts
> forwards,
>   JSF navigation rules and cases, etc) directly into the action methods.
> The
>   actions should describe what happened, not where to go next -- and this
> is
>   something I personally don't care for, even at the code level, the way
> that
>   WW2 does Results (or Spring MVC does ModelAndView) that combine
>   the two concerns together.  But that's a separate issue from whether
>   the encoding should be with annotations or not :-).

I agree with you here too.  I remember 5 years or so ago before I started
using Struts, we built our own framework here, and one of the really nice
things about it is that all the navigations rules were in a database... we
could literally change the flow of the application on the fly (a few
exceptions, as you might expect, but generally true).  Separating
navigation rules and such from the code I agree is probably not the right
use for annotations.

Good thoughts... I think we agree here almost entirely :)  I like your
differentiation too... I think when I said I wasn't sold on annotations
yet I may have been subconsciously thinking of the things we both think
may not be the best use for them.  Especially given EJB3, where I do
really see where they make life better, maybe I'm a little more on the
bandwagon than I thought already! :-)

> Craig

Frank


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

Reply via email to