views:

72

answers:

0

I'm trying to stick fast to Robert Martin's SOLID design principles for the first time, and I am not good at it.

In essence, I need a hierarchy of "Node" objects. Some nodes are NodeHosts, some are NodeChildren and some are Both. Everybody's done this one before, but I can't figure out how to do it SOLID without over-complicating the design or doing something like this in the node subtypes:

 INodeHostType node;
 public INodeType NodeType
 {
 ....
      set 
      {
          node = (INodeHostType)value;
      }
 }

This violates Liskov Substitution Principle right? What's a better way? Here's what I have now. alt text