Skip to main content

Introduction to Kotlin : New Official Programming Language for Android

Kotlin is a statically-typed programming language primarily developed by the team of JetBrains that runs on the Java Virtual Machine and also can be compiled to JavaScript source code or uses the LLVM compiler infrastructure. It's a modern programming language.

Development lead Andrey Breslav has said that Kotlin is designed to be an industrial-strength object-oriented language, and a "better language" than Java, but still be fully interoperable with Java code, allowing companies to make a gradual migration from Java to Kotlin.

Kotlin can be adopted for both sides of development backend and front end. One of the obvious applications of Kotlin is Android development. Android has announced Kotlin as it's official language in Google I/O 2017.

Why I should adopt Kotlin :
Although Java is one of the world's most widely used programming languages and is pretty much the official language for Android development, there are many reasons why Java might not always be the best option for your Android projects. The biggest issue is that Java isn’t a modern language and although Java 8 was a huge step forward for the platform, introducing lots of features that developers had been waiting for (including lambda functions), at the time of writing Android only supports a subset of Java 8 features, and yes how  can we forget null safety NullPointerException).

On other hands, Kotlin is a modern language providing all the feature of a modern language and even you can use your existing Java code to Kotlin and Kotlin code to Java. Interchangeability With Java makes us choose Kotlin over other modern programming languages. Kotlin eliminates most sources of null references by making all types non-nullable by default — meaning that the compiler won’t let you use a non-initialized, non-nullable variable. If you need a variable to hold a null value, you have to declare the type as nullable, adding a question mark after the type.

One of Kotlin’s main features is higher-order functions. If you’re familiar with JavaScript (or C# and many others), you probably already know all about these functions. A higher-order function takes functions as parameters or returns a function. One major use case for this is callback functions.

Kotlin aims to be an enhancement to Java, rather than a complete rewrite, so many of the skills you've acquired and honed throughout your Java career should still be applicable to your Kotlin projects.

At last, there is no programming language which is perfect it's also true for Kotlin :
Runtime Size : The Kotlin Standard Library and runtime will increase the size of your .apk. While this only equates to around 800KB, if your application is already on the large side then that extra 800KB may tip it over the edge and make users think twice before downloading your app.

Initial Readability : Although Kotlin’s concise syntax is one of the language's greatest strengths, you may initially find some Kotlin difficult to decipher, simply because there’s so much going on in such a small amount of code. Java may be more verbose, but the upside is that everything is clearly spelled out, which means unfamiliar Java code tends to be easier to decipher than unfamiliar Kotlin. Also, if used incorrectly, Kotlin’s operator overloading can result in code that’s difficult to read.

Official Support : Kotlin may have excellent support in Android Studio, but it’s worth remembering that Kotlin isn’t officially endorsed by Google. Also, Android Studio’s autocomplete and compilation tend to run slightly slower when you’re working with Kotlin, compared to a pure Java project.

Smaller Community and Less Available Help : As it's very new languages so Kotlin community is very small and very less help available on the internet.

You can find more info by visiting bellow links :
https://kotlinlang.org/docs
https://developer.android.com/kotlin/index.html
https://fabiomsr.github.io/from-java-to-kotlin/index.html

Comments

Popular posts from this blog

Future of Mobile Apps

More than 1 billion smartphones and 179 billion mobile applications downloaded per year, mobile development is certainly one of the innovative and rapidly growing sector. The mobile application market is arguably dominated by Google apps (Gmail, Maps, Search), Social media (Facebook, Instagram, Twitter, Youtube) and Gaming apps (Angry birds, Temple Run). Giants like Walmart, Bank of America and Amazon are using mobile applications for branding, improving customer engagement, direct marketing etc. This trend will continue in 2017 as well. There are lots of opportunities for startups and small companies. 1. AI will attract huge investment Industry analyst firms Granter and Forrester have revealed that there will be a 300% increase in investment in artificial intelligence. This is because business users now have unique and very powerful insights open to them. For example, giants like Facebook, Google and IBM are already investing in technologies (by acquiring startups) that would get

15 Key tips to reduce your Android App Size

Users often avoid downloading apps that seem too large, particularly in emerging markets where devices connect to often-spotty 2G and 3G networks or work on pay-by-the-byte plans. This article describes how to reduce your app's APK size, which enables more users to download your app. Understand the APK Structure Before discussing how to reduce the size of your app, it's helpful to understand the structure of an app's APK. An APK file consists of a ZIP archive that contains all the files that comprise your app. These files include Java class files, resource files, and a file containing compiled resources. An APK contains the following directories: META-INF/:   Contains the CERT.SF and CERT.RSA signature files, as well as the  MANIFEST.MF  manifest file. assets/:   Contains the app's assets, which the app can retrieve using an AssetManager object. res/:   Contains resources that aren't compiled into resources.arsc. lib/:   Contains the compiled co