<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx</link><description>Hey, I'm back! And in my new location. That was the longest and least relaxing vacation I've ever taken. Fun, yes. Relaxing, no. And to top it off, my kitchen is not done yet. We're shooting for being able to run water tonight and actually use appliances</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#48631</link><pubDate>Thu, 08 Jan 2004 15:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:48631</guid><dc:creator>Dmitriy Zaslavskiy</dc:creator><description>Welcome back.</description></item><item><title>re: Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#48764</link><pubDate>Thu, 08 Jan 2004 20:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:48764</guid><dc:creator>Eric Lippert</dc:creator><description>Thanks! It's good to be back!</description></item><item><title>re: Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#57619</link><pubDate>Sun, 11 Jan 2004 22:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:57619</guid><dc:creator>Dan Shappir</dc:creator><description>For years the brittle base class problem had been used as a justification for why COM (and thus also VB) lacked implementation inheritance. I recall reading a whole exposition by Kraig Brockschmidt as to why implementation inheritance is not really required for OOP (and BTW, I agree with him.)&lt;br&gt;&lt;br&gt;But then Microsoft got Java-envy and thus .NET not only supports implementation inheritance but makes significant use of it as a means for accessing system functionality. That is, it has effectively cemented the brittle base class problem into the OS. I could also argue that if implementation inheritance is such a good thing, C++-style multiple inheritance should also be supported.&lt;br&gt;&lt;br&gt;Another point is that many programmers mistakenly believe that implementation inheritance is key for achieving code reuse in OOP. This is simply incorrect. While some code reuse can be achieved this way, most is achieved by having old code call new code through interfaces. For that you only need interfaces 'inheritance'.</description></item><item><title>Security and Inheritance</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#58903</link><pubDate>Thu, 15 Jan 2004 13:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:58903</guid><dc:creator>Office Development, Security, Randomness...</dc:creator><description /></item><item><title>re: Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#59180</link><pubDate>Thu, 15 Jan 2004 22:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:59180</guid><dc:creator>Eric Lippert</dc:creator><description>There are lots of ways to achieve code reuse, and inheritance is just one of them.&lt;br&gt;&lt;br&gt;There are two main reasons that I see why people make class hierarchies.  The first is to express &amp;quot;is a&amp;quot; relationships and hence achieve polymorphism.  It doesn't matter whether classes Giraffe, Ungulate, Mammal and Animal share so much as a single line of code.  What matters is that a Giraffe IS AN Ungulate IS A Mammal... and so we have a class hierarchy.&lt;br&gt;&lt;br&gt;Now, that's all well and good, but most developers are extremely pragmatic.  Most developers look at inheritance and say &amp;quot;is-a-shmiz-a, I need to use a Gadget but I also need to associate each with a Frob, let's see, I suppose I could write a hash table mapping Gadgets to Frobs, oh, to heck with that, I'm subclassing Gadget to create FrobberGadget, add a public field, OK, I'm done.&amp;quot;&lt;br&gt;&lt;br&gt;Not a very &amp;quot;purist&amp;quot; way to develop, but hey, that's the world we live in.&lt;br&gt;</description></item><item><title>re: Virtual Methods and Brittle Base Classes</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#59490</link><pubDate>Fri, 16 Jan 2004 20:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:59490</guid><dc:creator>Dan Shappir</dc:creator><description>Developers will be developers, so I agree with your logic. But in my experience, if the developer has access to the Gadget source code, he'll just add the extra field to the original class, never mind that it's usually not needed and has nothing to do with the Gadget definition.&lt;br&gt;&lt;br&gt;OTOH if the developer does not have access to the Gadget source, or is not allowed to modify it, it becomes an issue of whether or not the class can even be subclassed. Does it even have virtual functions? Also, there is the issue of recreating all the constructors. Bottom line, creating FrobberGadget may be more trouble than it's worth, even for a hacker.&lt;br&gt;&lt;br&gt;My experience has been that most developers underuse implementation inheritance rather than overuse it.</description></item><item><title>Why Are So Many Of The Framework Classes Sealed?</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#61804</link><pubDate>Thu, 22 Jan 2004 23:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:61804</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description /></item><item><title>Why Are So Many Of The Framework Classes Sealed?</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#61814</link><pubDate>Fri, 23 Jan 2004 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:61814</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description /></item><item><title>Why Are So Many Of The Framework Classes Sealed?</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#62847</link><pubDate>Mon, 26 Jan 2004 06:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:62847</guid><dc:creator>Nazul's Weblog</dc:creator><description /></item><item><title>Why Are So Many Of The Framework Classes Sealed?</title><link>http://blogs.msdn.com/ericlippert/archive/2004/01/07/virtual-methods-and-brittle-base-classes.aspx#62850</link><pubDate>Mon, 26 Jan 2004 06:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:62850</guid><dc:creator>Nazul's Weblog</dc:creator><description /></item></channel></rss>