![]() If your internal API is convenient, then your code is more robust and maintainable. ![]() If we compare a program to a building, then its internal API is the foundation of the building. ![]() This leads to a poor design of internal APIs because to create convenient APIs using generics, you need to understand type variance, otherwise, you either don’t use generics at all or use them incorrectly. From my experience, many middle-level and sometimes senior-level Java and Kotlin developers fail to understand type variance. Some of you who learned these subjects in university might be having dreadful flashbacks because it can be complex stuff.īecause these terms look so scary, people avoid learning this topic regarding programming languages. It looks pretty scary already, doesn’t it? If we search Wikipedia, we will find covariance and contravariance in category theory and linear algebra. “There are three kinds of variance: invariance, covariance, and contravariance…”
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |