<?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>Comments on: Learn This: When to use an Abstract Class and an Interface</title>
	<atom:link href="http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/</link>
	<description></description>
	<lastBuildDate>Thu, 11 Mar 2010 00:49:25 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: maddy</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-320</link>
		<dc:creator>maddy</dc:creator>
		<pubDate>Sat, 06 Mar 2010 06:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-320</guid>
		<description>very nicly...described...will u please demostrate  OBJECT VS INSTANCE .AND object vs object variable . instance vs instance variable</description>
		<content:encoded><![CDATA[<p>very nicly&#8230;described&#8230;will u please demostrate  OBJECT VS INSTANCE .AND object vs object variable . instance vs instance variable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: imustbedumbthen</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-318</link>
		<dc:creator>imustbedumbthen</dc:creator>
		<pubDate>Thu, 04 Mar 2010 17:17:42 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-318</guid>
		<description>well, i guess you wouldn&#039;t hire me. ive been developing elegant yet sophisticated intra/internet apps that incorporate plenty of OO-design for 10 years and never found it practical to use interfaces in more than a few instances.

i was asked this question once, and resented it. its for a college kid just out of CS101, not proven professionals. unless you are a coder of advanced gaming and/or AI systems you BETTER NOT be spending so much time contemplating interface VS abstract. if i was your boss i would NOT be happy.

i am willing to bet most if you are web developers for backoffice business process automation systems and NOTHING more advanced than that. to feel the need to use such advanced OO concepts is overkill and over-coding. just make sure you follow good agile patterns, proper namespacing and standards, and enforce it accross the team, and you will have successful projects.</description>
		<content:encoded><![CDATA[<p>well, i guess you wouldn&#8217;t hire me. ive been developing elegant yet sophisticated intra/internet apps that incorporate plenty of OO-design for 10 years and never found it practical to use interfaces in more than a few instances.</p>
<p>i was asked this question once, and resented it. its for a college kid just out of CS101, not proven professionals. unless you are a coder of advanced gaming and/or AI systems you BETTER NOT be spending so much time contemplating interface VS abstract. if i was your boss i would NOT be happy.</p>
<p>i am willing to bet most if you are web developers for backoffice business process automation systems and NOTHING more advanced than that. to feel the need to use such advanced OO concepts is overkill and over-coding. just make sure you follow good agile patterns, proper namespacing and standards, and enforce it accross the team, and you will have successful projects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Stevens</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-315</link>
		<dc:creator>Christopher Stevens</dc:creator>
		<pubDate>Tue, 23 Feb 2010 20:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-315</guid>
		<description>I am a professional developer for over 20 years with strong object oriented skills and designs.  I agree with Shaun.  I would definitely stare back at the interviewer like DUH--if you don&#039;t understand how complex this is, then I am just going to give you the canned answer becasue that&#039;s probably what you want (because by asking this question you don&#039;t really understand the nuances of interface design).

Here is the basic problem with asking the question as written on this site.  IT IS LANGUAGE SPECIFIC.   The &quot;concept&quot; of abstract versus interface is different depending on the language you are using.  A good  CS Programming Languages course will make you appreciate that.  This question is very theoretical.    For example in C++ the distinction is very minimal and very context oriented--in C++ an &quot;interface&quot; is an abstract class which provides no implementation, has no members, and no constructor.  But to Anil&#039;s point, what if I had a class with 1000 members on it.  I could code an abstract class with default implementations and use that--in C++ this can still be used effectively as an interface.  There are some other subtle complexities with interfaces and template design in C++, but I won&#039;t go into that here.

However, move to C#.  The same is not true.  Why?  Because in C# the langauge only supports single inheritance, thus if you use an abstract base then you cannot offer any more interfaces--or rather you are stuck with a fat interface.   Since fat interfaces (i.e. putting all service methods into one class) is generally not a good practice we would like to separate out our interfaces based on the services they provide--the only way to do this in C# is through an interface. (A class can only extend a single base class whereas it can implement multiple interfaces; contrast to C++ a class can implement many base classes).

Thus the answer to your question is &quot;it depends.&quot;  What are our use cases?  What is our language we are coding in?  What runtime dependencies do the syntactical constructs impose?  What is the design goal behind class abstraction? based on these considerations, then I could answer why I would use one versus the other.  In my experience most developers can&#039;t properly code an interface without suffering from some unexpected coupling issues.

Choosing to use an interface as a design construct should be a well thought out and thorough examination of how the code/class will behave.</description>
		<content:encoded><![CDATA[<p>I am a professional developer for over 20 years with strong object oriented skills and designs.  I agree with Shaun.  I would definitely stare back at the interviewer like DUH&#8211;if you don&#8217;t understand how complex this is, then I am just going to give you the canned answer becasue that&#8217;s probably what you want (because by asking this question you don&#8217;t really understand the nuances of interface design).</p>
<p>Here is the basic problem with asking the question as written on this site.  IT IS LANGUAGE SPECIFIC.   The &#8220;concept&#8221; of abstract versus interface is different depending on the language you are using.  A good  CS Programming Languages course will make you appreciate that.  This question is very theoretical.    For example in C++ the distinction is very minimal and very context oriented&#8211;in C++ an &#8220;interface&#8221; is an abstract class which provides no implementation, has no members, and no constructor.  But to Anil&#8217;s point, what if I had a class with 1000 members on it.  I could code an abstract class with default implementations and use that&#8211;in C++ this can still be used effectively as an interface.  There are some other subtle complexities with interfaces and template design in C++, but I won&#8217;t go into that here.</p>
<p>However, move to C#.  The same is not true.  Why?  Because in C# the langauge only supports single inheritance, thus if you use an abstract base then you cannot offer any more interfaces&#8211;or rather you are stuck with a fat interface.   Since fat interfaces (i.e. putting all service methods into one class) is generally not a good practice we would like to separate out our interfaces based on the services they provide&#8211;the only way to do this in C# is through an interface. (A class can only extend a single base class whereas it can implement multiple interfaces; contrast to C++ a class can implement many base classes).</p>
<p>Thus the answer to your question is &#8220;it depends.&#8221;  What are our use cases?  What is our language we are coding in?  What runtime dependencies do the syntactical constructs impose?  What is the design goal behind class abstraction? based on these considerations, then I could answer why I would use one versus the other.  In my experience most developers can&#8217;t properly code an interface without suffering from some unexpected coupling issues.</p>
<p>Choosing to use an interface as a design construct should be a well thought out and thorough examination of how the code/class will behave.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anil deshpande</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-313</link>
		<dc:creator>anil deshpande</dc:creator>
		<pubDate>Mon, 22 Feb 2010 16:38:20 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-313</guid>
		<description>If an interface has 1000 methods then implementing class should implement all those 1000 methods ...How do we avoid this situation of
implementing those 1000 methods ...This is a question I ask in every interview</description>
		<content:encoded><![CDATA[<p>If an interface has 1000 methods then implementing class should implement all those 1000 methods &#8230;How do we avoid this situation of<br />
implementing those 1000 methods &#8230;This is a question I ask in every interview</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Preeti</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-312</link>
		<dc:creator>Preeti</dc:creator>
		<pubDate>Sun, 21 Feb 2010 15:04:49 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-312</guid>
		<description>Basically Use Interface when 
1) You want to make a contract/force all the concrete subclasses to implement methods of interface.
2) Use abstract class when you want to provide/force some functionality your self, and remaining subclasses can provide. One of the good example is template pattern where the base class/abstract class has a final method(which provides the template) and other methods are abstract, so all subclasses can override the abstract methods but they are forced to use the final method of the superclass.</description>
		<content:encoded><![CDATA[<p>Basically Use Interface when<br />
1) You want to make a contract/force all the concrete subclasses to implement methods of interface.<br />
2) Use abstract class when you want to provide/force some functionality your self, and remaining subclasses can provide. One of the good example is template pattern where the base class/abstract class has a final method(which provides the template) and other methods are abstract, so all subclasses can override the abstract methods but they are forced to use the final method of the superclass.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pareen Vatani</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-289</link>
		<dc:creator>Pareen Vatani</dc:creator>
		<pubDate>Tue, 05 Jan 2010 19:18:25 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-289</guid>
		<description>lets solve this in a easier way . 

Go for interface when u need programmers working on just the defination part where method name&#039;s and arguments will stay the same .Thus that will maintain the naming conventions.

Put methods in abstract class if defination is pretty much known.</description>
		<content:encoded><![CDATA[<p>lets solve this in a easier way . </p>
<p>Go for interface when u need programmers working on just the defination part where method name&#8217;s and arguments will stay the same .Thus that will maintain the naming conventions.</p>
<p>Put methods in abstract class if defination is pretty much known.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-287</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Thu, 31 Dec 2009 07:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-287</guid>
		<description>&lt;a href=&quot;#comment-39&quot; rel=&quot;nofollow&quot;&gt;@admin&lt;/a&gt; 
Well, many popular languages *do* toss one out: Python, C++, Dylan, etc.  I don&#039;t think I&#039;ve ever missed having the distinction in any of these languages.

I&#039;d throw the question back: Gosling claimed to have omitted MI for simplicity, but is that for the language user, or for the compiler writer?  Issues like this suggest that it&#039;s merely the latter.  OCaml programmers don&#039;t spend any time sitting around discussing this, and they don&#039;t seem to be hurting for productivity or type-safety or performance or anything else except possibly marketing budget.</description>
		<content:encoded><![CDATA[<p><a href="#comment-39" rel="nofollow">@admin</a><br />
Well, many popular languages *do* toss one out: Python, C++, Dylan, etc.  I don&#8217;t think I&#8217;ve ever missed having the distinction in any of these languages.</p>
<p>I&#8217;d throw the question back: Gosling claimed to have omitted MI for simplicity, but is that for the language user, or for the compiler writer?  Issues like this suggest that it&#8217;s merely the latter.  OCaml programmers don&#8217;t spend any time sitting around discussing this, and they don&#8217;t seem to be hurting for productivity or type-safety or performance or anything else except possibly marketing budget.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-285</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Fri, 18 Dec 2009 19:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-285</guid>
		<description>OMG, Wish I had read this YESTERDAY!  I had an interview on the phone today and didn&#039;t even have the oportunity to stare back like a deer!

I have been a professional for 30 Years, I have even taught Advanced Object Orentation and I dre the paverbial BLANK!
I tend to agree with Pratik but one can not be a Smart Axx in an interview!</description>
		<content:encoded><![CDATA[<p>OMG, Wish I had read this YESTERDAY!  I had an interview on the phone today and didn&#8217;t even have the oportunity to stare back like a deer!</p>
<p>I have been a professional for 30 Years, I have even taught Advanced Object Orentation and I dre the paverbial BLANK!<br />
I tend to agree with Pratik but one can not be a Smart Axx in an interview!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-280</link>
		<dc:creator>George</dc:creator>
		<pubDate>Fri, 04 Dec 2009 12:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-280</guid>
		<description>This is very helpful thoughts ....thanks</description>
		<content:encoded><![CDATA[<p>This is very helpful thoughts &#8230;.thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sanjeev</title>
		<link>http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/comment-page-1/#comment-256</link>
		<dc:creator>Sanjeev</dc:creator>
		<pubDate>Tue, 29 Sep 2009 16:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=146#comment-256</guid>
		<description>Hi 

   I am agree with Partik.I have face such kind of situation,where interviewer ask these question and when you explain they don&#039;t agree on that because they have feeling like they are taking interview.</description>
		<content:encoded><![CDATA[<p>Hi </p>
<p>   I am agree with Partik.I have face such kind of situation,where interviewer ask these question and when you explain they don&#8217;t agree on that because they have feeling like they are taking interview.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
