Let’s stay away from silver bullet claims

Apparently everybody’s  favourite JVM language beat Java in a recent code-smell contest. The Register reported on a paper by Bruno Gois Mateus and Matias Martinez who had carried out an extensive survey of the rate of Kotlin usage in recent open-source Android projects. Well, they’d have to be fairly recent, wouldn’t they. Using the Paprika tool to sniff out anti-patterns, they reached the not so surprising conclusion that the Kotlin code under scrutiny smelled a lot better than your average Android project in Java.

The paper is thirty impressive pages of tables, graphs and statistics charting the steady increase of Kotlin usage in open source. I love to see that Kotlin is on the rise. But I do take issue with their conclusion that after switching to Kotlin the quality of the majority of such applications increase (pardon their English). I’m sorry, but that’s just too tenuous an interpretation of the data. New projects in a new language, or an existing code base rewritten in that language are bound to score better than the strata of technical debt clinging to most Java projects. Give Kotlin projects ten years to mature and that clean slate won’t stay pristine forever.

A second factor sure to skew the findings is Kotlin’s early adopter stage. Current aficionados take their beloved language very seriously, working on still mint code bases, I might add. A Java/Kotlin battle with a truly level playing field would involve two teams of equally skilled engineers building the same non-trivial application in the same time. I bet the results would be distinctly underwhelming for the Kotlin camp.

Please let’s stop making exaggerated claims how language X will make you so much more productive. The comments in the Reg article pretty much express the same sentiment. It’s really not helpful if you want to persuade the people who have the authority to push development effort towards Kotlin. You have to use sensible arguments. Seasoned decision makers who are worth their salt can smell a silver bullet a mile off and will call BS.

Instead concentrate on the Kotlin features that enhance productivity and help you avoid mistakes. Some of my favourites, in no particular order: null-safe types, the in/out keywords in generic declarations, IDE support and inter-operability with existing tools and frameworks. Never tout conciseness as a unique selling point. Concise does not equate understandable and if concise is all you care about you should stick to Scala. I have writtenread enough boneheaded one-liners during my Perl days to last me a lifetime.

If you are looking for real killer arguments to sell Kotlin, then I have to disappoint you. I believe we should be realistic about the gains of switching to it coming from Java and that you should not make any exaggerated claims about those benefits. Just build awesome things with Kotlin, have fun doing it, share and be patient.


This entry was posted in Blog, Kotlin. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *