I’m trying to stick fast to Robert Martin’s SOLID design principles (check for more info The Ultimate Guide for 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.
![4R5F4|660x441](upload://7JaNYSveIePegOGrfDOnRAdA9l9.png)