title: Interface as a capability or Interface as a Type
body: <p>Suppose I have such requirement:<br>
  The objects in the system all derive from a base class named IObject, and it may have objects with color, objects with transformations, and both.</p>
  
  <p>Now there are 2 approach to design the class hierarchy.<br>
  The first one is:   </p>
  
  <blockquote>
    <p>just let concrete class derived from
    IObject, and also select "capability"
    interfaces as its base class to
    indicate it support such behavior,
    like interface:   IHasColor,<br>
    IHasTransformation</p>
  </blockquote>
  
  <p>The second one is:   </p>
  
  <blockquote>
    <p>Organize the base classes, and let
    concrete classes derived from one of
    them: IObject,   IColorObject,
    ITransfromationObject , 
    IColorAndTransformationObject</p>
  </blockquote>
  
  <p>I prefer the first one (Does it have a formal name? )  as it is more flexible, and as you can see the second one may have class combination explosion problem when there are many attributes like color, transformation... </p>
  
  <p>I would like to know your ideas and suggestions.</p>
  
  <p>Thanks.</p>