Lazy way of overriding functions

Last updated 1 year ago by Jan Kotlin

kotlin

This time I am just doing pure experimentation. I am sure this methodology of messing up your own code has some fancy scientific or mathematical name. The origin of this is when I was thinking about how limited we are in Android that every time we want to do something with Activity, we have to extend it somehow. And each of us has always experienced that new project starts with creating something called “BaseActivity”. And then later discovering that we need “EvenMoreBaseActivity”, and so on. Until we start begging to be able to actually modify and extend Activity instance itself.

I can’t promise solution to this problem right away (without creating NewFancyBasceActivity), but the technique I am explaining here, can be used for creating your next new shiny kotlin project. This kind of fancy coding is available because we have functions as first class citizens in Kotlin.

Read full Article