Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
Could you elaborate? Which property of the class
Human
is violated by its subclasses?That every human has a non-null father and mother is IMHO not a property of the class
Human
in this kata.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.