Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #864

Re: Frameworks: XML vs Annotations

From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Frameworks: XML vs Annotations
Date 2011-07-13 10:28 -0700
Organization http://groups.google.com
Message-ID <5d7997ac-3426-4272-b608-630df8c4c486@m3g2000pre.googlegroups.com> (permalink)
References <5ab7ef85-9c08-41af-97e2-5392e903de37@u26g2000vby.googlegroups.com> <ivkhs0$hjc$1@dont-email.me>

Show all headers | View raw


On Jul 13, 9:41 am, markspace <-@.> wrote:
> On 7/13/2011 7:39 AM, Steve wrote:
>
> > As much as I detest XML,  I think the XML option in Spring might best
> > provide such a "map"  versus annotations.  Additionally an XML config
> > file would make it easier to change the flow as all flow mappings
> > would be in one place.
>
> No experience specifically with Spring, but generally XML is the old way
> and in disfavor, and annotations are the new way and preferred.
>
> If you want to build a map of your annotations, consider an annotation
> processor:
>
> <http://download.oracle.com/javase/6/docs/technotes/guides/apt/index.html>
>
> <http://download.oracle.com/javase/6/docs/api/javax/annotation/process...>
>
> Some IDE will do this for you with some frame works.  E.g., NetBeans and
> JSF.

Spring, in particular, should be eschewed in favor of more standard
(Java EE) annotations.

For the primary question, sometimes XML configuration is helpful but
poorly-trained programmers tend to go config-file-happy with it, and
that's bad.  Consider a scenario where all screen widgets are defined
in XML configuration files.  Many find this excessively fragmented and
difficult to maintain, contrary to the golly-gosh-gee-whiz proponents
who claim the approach to be "flexible".  OTOH, to configure i18n
resources or database connections, external XML is very handy,
allowing reconfiguration of external resources without recompiling or
rebuilding an entire application as annotation changes would require.

So the answer to the "XML or annotations?" question is, "It depends."

--
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Frameworks:  XML vs Annotations Steve <tinker123@gmail.com> - 2011-07-13 07:39 -0700
  Re: Frameworks:  XML vs Annotations markspace <-@.> - 2011-07-13 09:41 -0700
    Re: Frameworks: XML vs Annotations lewbloch <lewbloch@gmail.com> - 2011-07-13 10:28 -0700

csiph-web