<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-3095723959445919352.post3569121499852963649..comments</id><updated>2008-06-27T11:30:26.125-04:00</updated><title type='text'>Comments on Steve's Personal Blog: Form inheritance in Visual Studio 2005</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.stevedinn.com/feeds/3569121499852963649/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default'/><link rel='alternate' type='text/html' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html'/><author><name>Steve Dinn</name><uri>http://www.blogger.com/profile/06027119098073825423</uri><email>steve@stevedinn.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3095723959445919352.post-5052360749935340234</id><published>2007-02-11T14:36:00.000-04:00</published><updated>2007-02-11T14:36:00.000-04:00</updated><title type='text'>Not quite. "is-a" vs. "has-a" is a trite catch-all...</title><content type='html'>Not quite. "is-a" vs. "has-a" is a trite catch-all rule for composition vs. inheritance, but in fact, composition is largely viewed as a better technique over inheritance for anything but the most trivial object models. GUI models are absolutely non-trivial. With inheritance you run into problems with conflicting base-classes especially in C++ (the "diamond" problem). All problems of multiple inheritance can be solved with composition. In this particular case, your problem would go away since the designer *could* create an instance of the class in question. The problem would be that you would have to delegate about 50+ methods that belong to the Window base-class. A Facet pattern (or even a Decorator pattern) would fix this problem much better, but obviously M$ still hasn't chosen a good object model for their GUI. You could probably handle this easily by using introspection and creating a dynamic proxy object for methods that you don't want to override. Actually, wouldn't the C# "delegate" option do this for you?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/5052360749935340234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/5052360749935340234'/><link rel='alternate' type='text/html' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html?showComment=1171218960000#c5052360749935340234' title=''/><author><name>MyDarkSecret</name><uri>http://www.blogger.com/profile/17478332939768000715</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html' ref='tag:blogger.com,1999:blog-3095723959445919352.post-3569121499852963649' source='http://www.blogger.com/feeds/3095723959445919352/posts/default/3569121499852963649' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3095723959445919352.post-5776653125338838869</id><published>2007-02-09T18:34:00.000-04:00</published><updated>2007-02-09T18:34:00.000-04:00</updated><title type='text'>Generally, the .Net framework does tend to favour ...</title><content type='html'>Generally, the .Net framework does tend to favour composition over inheritance, but the Forms and WebForms are the exception - as Steve says they lend themselves to inheritance much more readily.&lt;BR/&gt;&lt;BR/&gt;I agree that it would be nice to mark the abstract bases as abstract.  As I understand it, this is due to the fact that the designer actually instantiates an instance of your form at design time.  In fact, if you have a bunch of initialization in your constructor, you can actually end up with unwanted state saved in your form definition.  Ugghh.&lt;BR/&gt;&lt;BR/&gt;Another similar thing that drives me nuts is that XmlSerializable classes must have a default constructor whether this is appropriate for the design or not.  But that's another story...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/5776653125338838869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/5776653125338838869'/><link rel='alternate' type='text/html' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html?showComment=1171060440000#c5776653125338838869' title=''/><author><name>Brent Rockwood</name><uri>http://www.blogger.com/profile/00824743200045348176</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html' ref='tag:blogger.com,1999:blog-3095723959445919352.post-3569121499852963649' source='http://www.blogger.com/feeds/3095723959445919352/posts/default/3569121499852963649' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3095723959445919352.post-3195213998415545340</id><published>2007-02-09T16:57:00.000-04:00</published><updated>2007-02-09T16:57:00.000-04:00</updated><title type='text'>Ah, the old "is a" vs. "has a" conundrum.  You can...</title><content type='html'>Ah, the old "is a" vs. "has a" conundrum.  You can't really use composition effectively when you're dealing with dialogs.  You don't really want a dialog that "has" or "contains" another type of dialog, you want it to *be* that type of dialog.&lt;BR/&gt;&lt;BR/&gt;When a class becomes more tangible and has a visible portion such as a dialog or a window, the "has a" metaphor doesn't apply as easily.&lt;BR/&gt;&lt;BR/&gt;It's all about the polymorphism for me ;)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/3195213998415545340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/3195213998415545340'/><link rel='alternate' type='text/html' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html?showComment=1171054620000#c3195213998415545340' title=''/><author><name>Steve Dinn</name><uri>http://www.blogger.com/profile/06027119098073825423</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html' ref='tag:blogger.com,1999:blog-3095723959445919352.post-3569121499852963649' source='http://www.blogger.com/feeds/3095723959445919352/posts/default/3569121499852963649' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-3095723959445919352.post-7604401783026272956</id><published>2007-02-09T16:41:00.000-04:00</published><updated>2007-02-09T16:41:00.000-04:00</updated><title type='text'>Prefer Composition over Inheritance.</title><content type='html'>Prefer Composition over Inheritance.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/7604401783026272956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3095723959445919352/3569121499852963649/comments/default/7604401783026272956'/><link rel='alternate' type='text/html' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html?showComment=1171053660000#c7604401783026272956' title=''/><author><name>MyDarkSecret</name><uri>http://www.blogger.com/profile/17478332939768000715</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.stevedinn.com/2007/02/form-inheritance-in-visual-studio-2005.html' ref='tag:blogger.com,1999:blog-3095723959445919352.post-3569121499852963649' source='http://www.blogger.com/feeds/3095723959445919352/posts/default/3569121499852963649' type='text/html'/></entry></feed>