Danny Preussler
1 min readSep 27, 2016

--

Hi Jordan,

thanks for the response, appreciated.

You’re right, the article focuses on java ways even it shows example in Kotlin. I’m a big fan of OO, so that’s why I’m having a problem with type checks in general.

But of course if you don’t restrict yourself to OO you can go that way. Sealed classes with when was also suggested by @FE_Hudl. It’s a nice concept.

I somehow think a solution with this still violates the Open Close principle but the compiler tells you, so the damage is reduced a lot.

What I replied also to him was that I don’t see how the sealed classes would be a solution here. I didn’t wanted to touch the model classes. So forcing them all into one RVItem feels wrong to me as I would only do this for the presentation layer. It could be of use for the viewmodels.

But indeed I’,m thinking of adding a Kotlin specific part to the article, maybe also adding some niceties with extension functions to show that you don’t have to touch the models that way. :)

--

--

Danny Preussler
Danny Preussler

Written by Danny Preussler

Android @ Soundcloud, Google Developer Expert, Goth, Geek, writing about the daily crazy things in developer life with #Android and #Kotlin

Responses (1)