CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Raymond Lewallen

Framework Design, Agile Coach, President Oklahoma City Developers Group, Microsoft MVP C#, TDD, Continuous Integration, Patterns and Practices, Domain Driven Design, Speaker, VB.Net, C# and Sql Server

A few takes on polymorphism

A couple of days ago I talked about polymorphism.  I can't even begin to tell you what all discussions I've had since putting this up.  Let me start by saying this:  this post, as all my posts on OOP principles, are not intended to cover the complete aspect of the principle, and this applies most heavily to polymorphism.  Polymorphism can be a very complex concept and difficult to understand in certain situations.

1) "Polymorphism is coupled with inheritance." I made this statement in my post. Looking back, I probably shouldn't have because the statement is not true. More correctly, polymorphism can be coupled with inheritance, but inheritance is not requierd to gain polymorphic behavior.

2) Please read this post by Daniel Moth.  He counters on my statement discussed in #1 above, and he is correct.  This is a very good post, even if I did peeve him off little :)  Daniel's a very smart guy and I'm proud and appreciative to have his input on my postings.

3) Now that you've read Daniel's post... and I've also had this discussion via email with someone else who is very OOP knowledgable like Daniel is, and that is method overloading.  In my opinion, and in the opinion of others, overloading is a form of polymorphism, also referred to as compile-time polymorphism and parametric polymorphism.  I'll leave it to you to form your own opinion.

4) My polymorphism post was incomplete, and I apologize for that.  The post was meant to only give a very basic understanding of polymorphism in the .Net world to those who have never dealt with the aspect of it before.  Looking back, I should have discussed more about it and in greater depth.  To be honest, I left out other aspects of polymorphism (interface is the biggie) as not to unload too much at once and confuse anybody new to the idea.

Again, the post was not intended to give you the entire picture of polymorphism.  There are entire chapters of books dedicated to the subject, and I certainly wasn't going to attempt to do that in one blog post.  I merely intended to give a broad picture in how it applies most commonly to managed code (.Net).  Please do your own research, google the topics you read and form your own opinions.  This is true for all of my blog posts.


Comments

Grant said:

Dude, I've run into this before where you post something (http://codebetter.com/blogs/grant.killian/archive/2003/08/27/1276.aspx) and vehement academics come after you for not covering every angle and caveating each statement. It's like you've got to include an index and cross-references for each sentence in a post! I don't know about you, but I take maybe 10 or 15 minutes on a post and then I'm off to a new thought . . .

Anyway, hang in there and know that for every niggling detractor there are many more quiet readers who take in a post and move right along.
# March 18, 2005 11:44 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Raymond Lewallen

Working primarily in the public sector during his career, Raymond has designed and built several high profile enterprise level applications for all levels of the government. Raymond now works as a solutions architect for EMC. Raymond is an agile coach, Microsoft MVP C# and also president of the Oklahoma City Developers Group and Oklahoma Agile Developers Group. Raymond spends a lot of his time learning and teaching such things as Test Driven Development, Domain Driven Design, Design Patterns and Extreme Programming practices and principles, to name a few. Raymond is also an advocate of Alt.Net. Raymond is primarily a framework guy, so don't ask him anything about UI :) Check out Devlicio.us!