title: Subclass Coupling and an example in .NET
body: <p>I have just been reading <a href="http://www.theregister.co.uk/2008/04/18/emergent_design_part_three/" rel="nofollow">an article</a> that says:</p>
  
  <blockquote>
    <p>Subclass coupling. When a base type (usually class) has a number of derived types that extend it, other types should ideally only know about the base type. If all the subtypes share the same public interface (the public members inherited from the base type, overwritten for different behavior in each subclass), then outside "client" types can treat them all the same, as if they were the base class. If this is not so, if a client type knows specifics about the subtypes that exist, then this is subclass coupling to the polymorphic structure in question.</p>
  </blockquote>
  
  <p>Specifically, the last line says that "if a client type knows specifics about the subtypes that exist...".  In .NET, if I use the <code>WebRequest.Create("ftp://...");</code> then I know that an <code>FtpWebRequest</code> will be returned, and that I can change properties that are specific to the <code>FtpWebRequest</code> subclass, such as the <code>UseBinary</code> property.  I wouldn't be able to do that unless I had specific knowledge about the subtype of WebRequest, so in my mind, this is a case of subclass coupling and is bad design.</p>
  
  <p>I struggle to believe that this is bad design on behalf of the .NET framework developers, and instead imagine that my understanding of the above is a little off.  Would someone be able to explain why the example I have provided in .NET is not an example of subclass coupling?</p>