Google-backed Kotlin Gains Adoption in Open Source Android Apps; Scientists Say It Has Improved Code Quality (theregister.co.uk)
Kotlin, which Google blessed last year as an alternative to Java for programming Android apps, has already made its way into almost 12 per cent of open source Android apps, and in so doing has elevated their code quality. From a report: So we're told by computer scientists Bruno Gois Mateus and Matias Martinez, affiliated with University of Valenciennes in France, who observed that Google at the end of 2017 said Kotlin had infiltrated more than 17 per cent of Android apps developed with its IDE, Android Studio 3.0. Kotlin is an open source statically typed programing language that targets the JVM, Android, JavaScript (transpiling to ES5.1) and native platforms (via LLVM). JetBrains, the company that created it, contends Kotlin is more concise and more type-safe than Java. It estimates that apps written in Kotlin require about 40 per cent less code than they would with Java. With fewer lines of code, in theory, one can expect fewer bugs. In a paper distributed through pre-print service ArXiv, "An Empirical Study on Quality of Android Applications written in Kotlin language," Mateus and Martinez describe how they gathered 925 apps from the open source F-Droid repository, measured the amount of Kotlin code in each, and analyzed the code for "smells" as an indicator of code quality.
CheckedExceptions have been considered a language flaw in Java for a very long time by a large percentage of its users. Examples of problems with them:
*Writing throws statements on each function causes propagation up the chain and leads to either being forced to catch Exception or have functions with a half dozen throws on it.
*Removing the necessity of throwing on any function in the change causes massive changes to all callers, which is time consuming and causes unnecessary churn. Especially bad with libraries.
*Having to declare your function throws an exception because something used 3 levels down throws it in a 1 in a million error case is not only annoying, but its confusing.
*If you override a function with a checked exception, you must declare yourself as throws... even if you don't throw that exception in any condition. Which is just wrong, your function can't throw it.
*Checked exceptiosn don't work well with lambdas.
*Checked exceptions make some things like visitor patterns much more difficult.
What annoys me more about Kotlin is that classes are final by default. I know more about my use case than you. If I decide that the best way of implementing something is to extend your class, I have a good reason for it. Preventing me just makes your code less usable.
I still have more fans than freaks. WTF is wrong with you people?