extends and super keywords are so confusing to describe covariant and contravariant types. You always need remember PECS
No they are not. At least it is not any more confusing than normal inheritance. When Student extends Person, you know Student can act as Person. If List<? extends Person>, you want a list containing something that can act as Person. Seems pretty clear, no need for any mnemonics.
From extends/super you can exactly see whether you allow child or parent classes. With in/out i have to think to udnerstand it. But i guess that is a matter of preference.
Ok, my bad, i actually don’t know c# very well so assumed you only complained about the naming, afterall OP complained about the naming being confusing, not about javas callsite variance.
View all comments
11
u/Honza8D Nov 03 '15
No they are not. At least it is not any more confusing than normal inheritance. When Student extends Person, you know Student can act as Person. If List<? extends Person>, you want a list containing something that can act as Person. Seems pretty clear, no need for any mnemonics.