<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Annotations/Attributes: How do they help us?</title>
	<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/</link>
	<description>A blog about programming in .NET and Java</description>
	<pubDate>Thu, 20 Nov 2008 10:15:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Aleks Seovic</title>
		<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-339</link>
		<pubDate>Fri, 24 Feb 2006 05:47:53 +0000</pubDate>
		<guid>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-339</guid>
					<description>Hi Arjen,

I think you guys didn't cover one use of annotations that is in my opinion probably the best -- as a joinpoint that aspect pointcuts can be defined against.

I really believe that annotations/attributes are the best pointcut targets. When used that way, they both document the members they are on and allow very easy application of aspects that doesn't depend on the naming conventions. @Transactional and @Cached are great examples  -- they really don't do anything by themselves other than document the method they are on, but they provide a very simple way to define a pointcut for transaction and cache aspects.

I wish I was at Cortina, seems like there were some good discussions there this year. Well, there is always next year, hopefully Jimmy will give me bit more advance notice than this year :)</description>
		<content:encoded><![CDATA[<p>Hi Arjen,</p>
<p>I think you guys didn&#8217;t cover one use of annotations that is in my opinion probably the best &#8212; as a joinpoint that aspect pointcuts can be defined against.</p>
<p>I really believe that annotations/attributes are the best pointcut targets. When used that way, they both document the members they are on and allow very easy application of aspects that doesn&#8217;t depend on the naming conventions. @Transactional and @Cached are great examples  &#8212; they really don&#8217;t do anything by themselves other than document the method they are on, but they provide a very simple way to define a pointcut for transaction and cache aspects.</p>
<p>I wish I was at Cortina, seems like there were some good discussions there this year. Well, there is always next year, hopefully Jimmy will give me bit more advance notice than this year <img src='http://blog.springsource.com/arjen/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
				</item>
	<item>
		<title>by: A Couple of Dutch Rants &#187; So when SHOULD you use annotations?</title>
		<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-338</link>
		<pubDate>Mon, 20 Feb 2006 19:02:02 +0000</pubDate>
		<guid>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-338</guid>
					<description>[...] [1] Uri Boness in Dude, where&amp;#8217;s my class? [2] Arjen Poutsma in Annotations/Attributes: How do they help us? [3] Rod Johnson in Ecsaping the Technology Cycle [4] Arjen Poutsma in Annotations vs. Interoperability [5] myself in Re: Annotations vs. Interoperability [6] Uri Boness in Verifying configuration in Spring &amp;#160; [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] [1] Uri Boness in Dude, where&#8217;s my class? [2] Arjen Poutsma in Annotations/Attributes: How do they help us? [3] Rod Johnson in Ecsaping the Technology Cycle [4] Arjen Poutsma in Annotations vs. Interoperability [5] myself in Re: Annotations vs. Interoperability [6] Uri Boness in Verifying configuration in Spring &nbsp; [&#8230;]</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Arjen Poutsma</title>
		<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-334</link>
		<pubDate>Fri, 10 Feb 2006 10:55:29 +0000</pubDate>
		<guid>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-334</guid>
					<description>Bruce,

Actually, I did a little experiment which shows that - even with a Runtime retention policy - annotated classes do not need their annotations present at runtime. This was a bug in JDK 1.5 (present in at least 1.5.0-02), but it was fixed recently (1.5.0-06 or an earlier release).

To do the same experiment, just create an annotation, a class with is annotation with it (let's call it A),  and a class which uses A (let's call that B). If you run B when the annotation is on the classpath, A.class.getAnnotations() shows the annotation. When the annotation is not on the classpath, the annotation is simply not there: no NoClassDefFoundError.</description>
		<content:encoded><![CDATA[<p>Bruce,</p>
<p>Actually, I did a little experiment which shows that - even with a Runtime retention policy - annotated classes do not need their annotations present at runtime. This was a bug in JDK 1.5 (present in at least 1.5.0-02), but it was fixed recently (1.5.0-06 or an earlier release).</p>
<p>To do the same experiment, just create an annotation, a class with is annotation with it (let&#8217;s call it A),  and a class which uses A (let&#8217;s call that B). If you run B when the annotation is on the classpath, A.class.getAnnotations() shows the annotation. When the annotation is not on the classpath, the annotation is simply not there: no NoClassDefFoundError.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Bruce</title>
		<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-333</link>
		<pubDate>Fri, 10 Feb 2006 00:53:01 +0000</pubDate>
		<guid>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-333</guid>
					<description>When you said (right at the end) &quot;In Java, with looser reference resolving, this does not appear to be the case: the class is simply not annotated if it cannot find the annotations at runtime.&quot;

If the classloader can't find the class definition (*.class) for a RetentionPolicy.RUNTIME annotation, you will get a NoClassDefFoundError when loading the annotated class. For the other retention policies, the annotation is not visible at runtime.</description>
		<content:encoded><![CDATA[<p>When you said (right at the end) &#8220;In Java, with looser reference resolving, this does not appear to be the case: the class is simply not annotated if it cannot find the annotations at runtime.&#8221;</p>
<p>If the classloader can&#8217;t find the class definition (*.class) for a RetentionPolicy.RUNTIME annotation, you will get a NoClassDefFoundError when loading the annotated class. For the other retention policies, the annotation is not visible at runtime.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Steve Loughran</title>
		<link>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-331</link>
		<pubDate>Thu, 09 Feb 2006 22:28:42 +0000</pubDate>
		<guid>http://blog.springsource.com/arjen/archives/2006/02/09/annotationsattributes-how-do-they-help-us/#comment-331</guid>
					<description>Given that I work on a deployment/configuration product, SmartFrog (http://smartfrog.org/), you'd expect me to be biased against annotations in code. And I am, if done badly.

-in an ideal world, all configuration information is under SCM, all deployment and configuraton is automated. 

-in a complex project, different people own different parts of the config, the DBA, the sysadmin, the router administrator. They dont code. But they can sometimes be persuaded to write their own config files and keep them under SCM.

-where annotations in source is good is when the source provides lots of the information itself, like class and method names, types, etc. Why repeat this information (possibly incorrectly) in a config file?

-but the stuff in the code, it should only be a hint. I may defined the table and column names in my EJB annotations, but the DBA has the right to override them. 

-what is wrong is having to edit the source or rebuild a WAR/EAR file just to deploy on a different target. Because someone always ends up deploying the wrong one</description>
		<content:encoded><![CDATA[<p>Given that I work on a deployment/configuration product, SmartFrog (http://smartfrog.org/), you&#8217;d expect me to be biased against annotations in code. And I am, if done badly.</p>
<p>-in an ideal world, all configuration information is under SCM, all deployment and configuraton is automated. </p>
<p>-in a complex project, different people own different parts of the config, the DBA, the sysadmin, the router administrator. They dont code. But they can sometimes be persuaded to write their own config files and keep them under SCM.</p>
<p>-where annotations in source is good is when the source provides lots of the information itself, like class and method names, types, etc. Why repeat this information (possibly incorrectly) in a config file?</p>
<p>-but the stuff in the code, it should only be a hint. I may defined the table and column names in my EJB annotations, but the DBA has the right to override them. </p>
<p>-what is wrong is having to edit the source or rebuild a WAR/EAR file just to deploy on a different target. Because someone always ends up deploying the wrong one</p>
]]></content:encoded>
				</item>
</channel>
</rss>
