Ad
  • Custom User Avatar

    It's not about property, but expected behaviour of subclass. One could (reasonably) expect that object of human subclasses will have existing parents, since we force human creation polity that way. After all, if we consider this as part of larger piece of software, all humans can be used in different ways. Since they expose Mother/Father properties, these properties may be used. At one point Adam or Eve object may be used in a manner that do not indicate their unnatural properties, which can led to inconsistency. If they are created just for the sake of ie. being parents to the other humans, and then kept aside, this is fine tho.

  • Custom User Avatar

    I have a feeling that this kata violates somehow Liskov' Substitution Principle, namely when we expect every human to be produced by father and mother, which implies that every human has parents, but then we ie. assign adam instance to Male and bum - it's null, wtf. I do understand it shows type hierarchy, but imho proper OOP requires also that subclasses do not violate parent class behaviour.