1. 程式人生 > >What do 17 Google Developers Experts for Android think about Kotlin?

What do 17 Google Developers Experts for Android think about Kotlin?

I started developing for Android as a natural evolution from being a Java guy. The language was shared, so I decided to give it a try. And it was a choice full of sense at the time. In my personal case, this kick-off moment was in 2009.

Java was born in 1995. Since then a few versions have been published, increasing and improving its initial features, being the current version Java 8. Java was designed 22 years ago, which is an eternity considering how technology evolves

, and it has currently a few flags hard to ignore. As a developer, I always experimented with other languages. The most noticeable example of a language solving some of the Java flags was Scala. The inflection point was when I saw a language like Swift in action. I do also code for iOS, and noticing how Swift was overcoming obvious problems such as nullability open my eyes on the holes in Java I had always ignored.

Due to its nature, Android natively supports all Java 7 features but only a subset of the ones present in Java 8, This supposes rather a deceleration in how the Android ecosystem can cope with other platforms. And Kotlin here is helping to fill the void.

Kotlin is a modern language (the version 1.0 was released as recently as February 2016). Its original aim was to supply the deficiencies of Java

, as Scala does, but solving some of the present issues (for instance, the compiling time). JetBrains is doing an amazing job at it, and the compilation times have improved astonishingly in the last versions. As a newcomer into Kotlin, these are the answers to the questions I initially had in mind:

– Interoperability with Java: Kotlin can directly interact with Java classes and the other way around. That was a basic point: I did want to reuse my codebase and adapt it into Kotlin.

– Conversion tools: although the automatic conversion of Java to Kotlin is not to be trusted blindly, it makes a really damn good job. When I am converting Java classes, I think I can easily reuse 60%-70% of the resulting code. My approach is not to convert an entire codebase from Java to Kotlin overnight, but doing it following little steps. And the revision time after applying the automatic conversion is minimal.

Coming to Kotlin itself, it was great to experiment with something fresh after developing many years with Java. If you are a Java developer, the syntax of Kotlin comes very naturally. If you are a Swift developer it will happen the same, and you will have the benefit of understanding a few key concepts such as Nullability. The features that grabbed my attention more from Kotlin were the following:

– Nullability: telling your business that you can avoid 2/3 of your exceptions in productions is appealing. And you do not know how of a mess this is is Java until you start using Kotlin.

– Functional programming: yes, Kotlin supports functional programming, as Scala does.

– Default and named arguments: again, if you have not tried something before you can’t miss something. In Kotlin you can set up a default value for a parameter in a function, and give a name to each of them. This just increases legibility and readability of the code exponentially.

– Smart casting: tired of using instanceof and then casting the object? It always seemed to be something very redundant that could have been easily prevented. Kotlin does this automatically for you.

There are a bunch of things in Kotlin that would take a few articles to enumerate and dive in. Summarizing: Kotlin is a language that comes to supply and improve some of the Java scarcities. The learning curve is very gentle for Java developers. It is not an EITHER/OR type of question, since you can use both languages in your Java base. Kotlin will increase your productivity, and make you a better programmer in the medium and long term.

相關推薦

What do 17 Google Developers Experts for Android think about Kotlin?

I started developing for Android as a natural evolution from being a Java guy. The language was shared, so I decided to give it a try. And it was a c

Ask HN: What do you use MS Excel for?

I've heard that Excel is really powerful. Do you guys have any stories about that? Whether it's personal or for business what do you use it for?

What should be in my .gitignore for an Android Studio project?

發現開一個新的 Repository  來放 android studio 的 source code,需要手動去設定  ~/.gitignore 檔案,如果沒有設會加入很多垃圾檔案進 git 裡。設定檔: #built application files *.apk *.ap_ # files

Android Developers Blog: Kotlin Momentum for Android and Beyond

Posted by James Lau (@jmslau), Product Manager Today marks the beginning of KotlinConf 2018 - the largest in-person gathering of the Kotlin community a

Ask HN: What do you look for in a professional support contract for OSS?

Dear HNOccasionally on HN I read a comment where someone bemoans the lack of professional support for open source software and how their company would love

Ask HN: What Do You Do When Your Phone Is in the Shop for Repair?

I pull out an old phone from my drawer, swap the SIMs and live in the past for a couple of days. With most of my old smartphones I need

Android Developers Blog: C++ audio library for Android

Android Developers Blog The latest Android and Google Play news for app and game developers.

Android Developers Blog: how to develop audio apps for android

Posted by Don Turner, Developer Advocate, Android Audio Framework This week we released the first production-ready version of Oboe - a C++ library f

Android Developers Blog: OpenSL ES for Android

Posted by Don Turner, Developer Advocate, Android Audio Framework This week we released the first production-ready version of Oboe - a C++ library f

Introduction to Glide, Image Loader Library for Android, recommended by Google

In the passed Google Developer Summit Thailand, Google introduced us an Image Loader Library for Android developed by bumptech named Glid

Ask HN: Hiring managers, what do you look for in a junior dev?

What does 0-3 years of experience mean to you? Are you hoping to retain them for a long time? Do you prefer exposure to certain technology? How do you meas

Android Developers Blog: R8, the new code shrinker from Google, is available in Android studio 3.3 beta

Posted by Leo Sei, Product Manager on Android Studio and R8 Android developers know that APK size is an important factor in user engagement. Code shrin

Flutter For Android Developers : How to design FrameLayout in Flutter.

This blog is meant for Android developers looking to apply their existing Android knowledge to build mobile apps with Flutter. In this blog, we are

【譯】Flutter For Android Developers:如何在Flutter中設計FrameLayout。

此部落格適用於希望應用現有Android知識的Android開發人員使用Flutter構建移動應用程式。在這篇部落格中,我們將探討Flutter中FrameLayout的等效設計小部件。 原文:https://medium.com/flutter-community/flutter-for-an

Kotlin for Android Developers

If at any time you have tried to investigate on your own, then you are aware of the amount of time we sometimes spend to find the solution we are loo

Kotlin for Android Developers: The book

Hi dear reader. Today it’s a very special post, because I’m really happy to announce the release of my first book: Kotlin for Android Developers is

What do you recommend for Postgres: Amazon or Heroku? Documentation

Heroku’s simple set up and administration process make it a great option to get up and running quickly.Amazon’s service has some more powerful features and

三、VR視訊播放器開發 ---- Android VR視訊/Google VR for Android /VR Pano/VR Video

simplevideowidget 如果沒有看上一篇文章的請先看完再來看這一篇吧,有寫重複的就不介紹了 AndroidManifest 上一篇文章有提到,其實這裡也沒有什麼特別的 build.gradle dependencie

二、VR全景圖顯示器開發 ---- Android VR視訊/Google VR for Android /VR Pano/VR Video

這篇看下SimpleVrPanorama這個栗子 SimpleVrPanorama 其實這篇應該寫SimpleVrPanorama和simplevideowidget 兩個,但是由於篇幅過長就分開寫了 演示 用AS錄的沒有觸控點顯示,

Google I/O 2014 - Keynote for Android

man 部件 android ive ref post 模式 什麽 ons 版權聲明:本文為博主原創文章,未經博主同意不得轉載。 https://blog.csdn.net/jingxia