<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
	<atom:link href="http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=marker-interfaces-and-c-attributes</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-2/#comment-34549</link>
		<dc:creator>Yevgeny Pechenezhsky</dc:creator>
		<pubDate>Sun, 05 Oct 2008 05:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-34549</guid>
		<description>Marker interfaces can be used to express domain artifacts within the confines of a single object model. Whether this is a good solution or not will, of course, depend on the domain in question. Attributes, on the other hand, are not suitable for such a purpose at all since metadata rests in a dimension outside the object model altogether. The immediate implication here is that with attributes, you don&#039;t get compile-time resolution for all artifacts in a domain model (not to mention the associated loss of in-IDE code hinting).</description>
		<content:encoded><![CDATA[<p>Marker interfaces can be used to express domain artifacts within the confines of a single object model. Whether this is a good solution or not will, of course, depend on the domain in question. Attributes, on the other hand, are not suitable for such a purpose at all since metadata rests in a dimension outside the object model altogether. The immediate implication here is that with attributes, you don&#8217;t get compile-time resolution for all artifacts in a domain model (not to mention the associated loss of in-IDE code hinting).</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-2/#comment-30605</link>
		<dc:creator>Johannes Hansen</dc:creator>
		<pubDate>Wed, 27 Aug 2008 00:38:49 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-30605</guid>
		<description>Hi guys just saw this post now and thought I wanted to give my 2c.

Will - The most significant disadvantage of using interfaces is the inability to control the marker when you start inheriting from the marked class. Attributes lets you specify if the marker should be inherited by derived classes while interfaces doesn&#039;t allow you to have that control. 

Also, attributes have the advantage that you can mark  other things than classes, such as methods, parameters, constructors, fields, properties etc.

And as Skup points out the correct way to check for marker attributes is to use Attribute.Isdefined() or classInstance.GetType().IsDefined() and as he said you might even make it easier by adding some sort of generic methods or something... So I did. ;) You can see the result on my blog (http://blog.johannesh.dk).</description>
		<content:encoded><![CDATA[<p>Hi guys just saw this post now and thought I wanted to give my 2c.</p>
<p>Will &#8211; The most significant disadvantage of using interfaces is the inability to control the marker when you start inheriting from the marked class. Attributes lets you specify if the marker should be inherited by derived classes while interfaces doesn&#8217;t allow you to have that control. </p>
<p>Also, attributes have the advantage that you can mark  other things than classes, such as methods, parameters, constructors, fields, properties etc.</p>
<p>And as Skup points out the correct way to check for marker attributes is to use Attribute.Isdefined() or classInstance.GetType().IsDefined() and as he said you might even make it easier by adding some sort of generic methods or something&#8230; So I did. <img src='http://elegantcode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  You can see the result on my blog (<a href="http://blog.johannesh.dk" rel="nofollow">http://blog.johannesh.dk</a>).</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-29058</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Tue, 05 Aug 2008 04:58:16 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-29058</guid>
		<description>Interestingly enough, the MS guideline states:
   &quot;Custom attributes are preferred when you can defer checking for the attribute until the code is executing. If your scenario requires compile-time checking, you cannot comply with this guideline.&quot;

However, it doesn&#039;t state why marker interfaces should be avoided.  Certainly, there is a convenience to using interfaces.  However, the extension method approach for attributes is minimal.  Still, as Pieter says, this is code to be maintained and tested.

Unless there is a significant performance concern using marker interfaces (which seems unlikely to be slower than reflection), then I probably would lean toward interfaces over attributes.

Are there other advantages that attributes provide?  I suppose, you can include parameters on your attributes to drive behavior.</description>
		<content:encoded><![CDATA[<p>Interestingly enough, the MS guideline states:<br />
   &#8220;Custom attributes are preferred when you can defer checking for the attribute until the code is executing. If your scenario requires compile-time checking, you cannot comply with this guideline.&#8221;</p>
<p>However, it doesn&#8217;t state why marker interfaces should be avoided.  Certainly, there is a convenience to using interfaces.  However, the extension method approach for attributes is minimal.  Still, as Pieter says, this is code to be maintained and tested.</p>
<p>Unless there is a significant performance concern using marker interfaces (which seems unlikely to be slower than reflection), then I probably would lean toward interfaces over attributes.</p>
<p>Are there other advantages that attributes provide?  I suppose, you can include parameters on your attributes to drive behavior.</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28698</link>
		<dc:creator>Skup</dc:creator>
		<pubDate>Thu, 31 Jul 2008 17:03:05 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28698</guid>
		<description>You could use the Attribute.IsDefined method ?
And even make a little generic helper to make it simple and cool !</description>
		<content:encoded><![CDATA[<p>You could use the Attribute.IsDefined method ?<br />
And even make a little generic helper to make it simple and cool !</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28688</link>
		<dc:creator>Dew Drop - July 31, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Thu, 31 Jul 2008 14:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28688</guid>
		<description>[...] Marker Interfaces and C# Attributes (Alex Mueller) [...]</description>
		<content:encoded><![CDATA[<p>[...] Marker Interfaces and C# Attributes (Alex Mueller) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28678</link>
		<dc:creator>Tim Van Wassenhove</dc:creator>
		<pubDate>Thu, 31 Jul 2008 08:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28678</guid>
		<description>This topic is discussed in http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756 .. 

As already mentionned, if i need compile-time certainty, the marker interface is the only one that can help me... (Otherwise, an attribute is probably a better &#039;marker&#039;...)</description>
		<content:encoded><![CDATA[<p>This topic is discussed in <a href="http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756" rel="nofollow">http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756</a> .. </p>
<p>As already mentionned, if i need compile-time certainty, the marker interface is the only one that can help me&#8230; (Otherwise, an attribute is probably a better &#8216;marker&#8217;&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28677</link>
		<dc:creator>Pieter</dc:creator>
		<pubDate>Thu, 31 Jul 2008 08:05:44 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28677</guid>
		<description>If I understand correctly you are not in favour of using marker interfaces and recommend attributes should rather be used.

Thus in order to find out whether an object is FooAssignable I need to write a helper method (very sexy piece of code I must add!!), which internally uses Reflection and is an extra piece code to be maintained and tested.

I am not against Reflection, I just think it should be used in the appropriate places, and not to replace existing functionality in the framework.

To make a long story short, why write your own code to replace something that  can already be achieved through the framework?</description>
		<content:encoded><![CDATA[<p>If I understand correctly you are not in favour of using marker interfaces and recommend attributes should rather be used.</p>
<p>Thus in order to find out whether an object is FooAssignable I need to write a helper method (very sexy piece of code I must add!!), which internally uses Reflection and is an extra piece code to be maintained and tested.</p>
<p>I am not against Reflection, I just think it should be used in the appropriate places, and not to replace existing functionality in the framework.</p>
<p>To make a long story short, why write your own code to replace something that  can already be achieved through the framework?</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28675</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #148</dc:creator>
		<pubDate>Thu, 31 Jul 2008 07:29:11 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28675</guid>
		<description>[...] Marker Interfaces and C# Attributes - Alex Mueller compares marker interfaces and attributes for allowing a class to be marked as having some specific behaviour. I think my preference would have to be the interface over the attribute in this case. [...]</description>
		<content:encoded><![CDATA[<p>[...] Marker Interfaces and C# Attributes &#8211; Alex Mueller compares marker interfaces and attributes for allowing a class to be marked as having some specific behaviour. I think my preference would have to be the interface over the attribute in this case. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28673</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 31 Jul 2008 04:19:38 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28673</guid>
		<description>If I am doing a marker interface for just type checking, then o me that is a code smell, maybe a violation of LSP if I am so concerned about the concrete type. But in the upper mapper layers I come across this so I might violate this.</description>
		<content:encoded><![CDATA[<p>If I am doing a marker interface for just type checking, then o me that is a code smell, maybe a violation of LSP if I am so concerned about the concrete type. But in the upper mapper layers I come across this so I might violate this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Ventolin ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/comment-page-1/#comment-28657</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Wed, 30 Jul 2008 23:21:42 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2008/07/30/marker-interfaces-and-c-attributes/#comment-28657</guid>
		<description>One advantage of marker interfaces is that it allows some scenarios with regards to generics.  For example:

public class Repository where T : IAggregateRoot

This gives you compile-time protection for certain scenarios, while attributes are only run-time.</description>
		<content:encoded><![CDATA[<p>One advantage of marker interfaces is that it allows some scenarios with regards to generics.  For example:</p>
<p>public class Repository where T : IAggregateRoot</p>
<p>This gives you compile-time protection for certain scenarios, while attributes are only run-time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

