Do you check who are you talking to?
Avoid kind, isKindOf, instance, getClass(), typeOf, etc..
Don't use Reflection and Metaprogramming for Domain Objects.
Replace IFs with polymorphism.
Avoid checking for 'undefined'. Use complete objects, avoid nulls and setters, favor immutability and you will never have undefined and ifs.
Since type checking methods are well known it is very easy to set up a code policy checking the uses.
Testing for a class type couples the objects with accidental decisions and violates bijection since no such control exists on real world. It is a smell our models are not good enough.
Photo by Remy Gieling on Unsplash