Kotlin - a Multi purpose tool

Featured on Hashnode

Life of a Developer is not easy these days(well it never was), Companies aggressively marketing their tools i.e IDE's, Programming languages etc. It's hard to cop up with every new shiny tool.

But :),

“Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code.” – Dan Salomon

I have started my career as Android Native developer (JAVA), just after 2 months my boss come to my desk and He said :

Asif , we have a client who wants his app to be developed on flutter framework. (Thanks to googles aggressive marketing), client knows such a thing exists, then conversation stared :

Me: I heard about flutter but never worked.
Boss: Can you learn?
Me: Yes, of course but I need time.
Boss: ok, Client is not in a hurry and I know him well we can get a month extra.
Me: ok I'll start learning it then.

I started learning flutter from next day, bought a course on udemy, youtube videos, medium.
The flutter community is very supportive , I learned Flutter well, build the app and released it on both platforms(ios/android).
since, then i never looked back, had build several apps for different domains.

Learning flutter was best decision I have taken in my life of course my boss needs some credit also.

but their was always one thing, I never felt that I know Dart very well, it has a whole ecosystem of tools, libraries and more. Its a modern language and a young language , continuously evolving very quickly.

Dart syntax is very familiar to java and c family languages :

Dart

helloworld-dart.png

If you have ever worked with javascript, java or any oop language , dart feels familiar.
learn more about dart : Dart official

I want to master this cute new language that makes life so easy, as young language , new features coming every few months it a quite difficult to cop up.
dart soon going to have sound null safety Inspired by Kotlin.

The problem with mastering dart by learning dart is quite difficult as article, books, videos created for dart, deprecates pretty soon, you have to always rely on documentation and announcements presented by dart team.
So I have taken different approach by choosing kotlin to learn idiomatic dart well and to work on Android native Api's for some specific use cases.

kotlin

kotlin hello world.png Dart inspires its features from kotlin, which is already implemented in kotlin, dart sound null safety is one of them(upcoming), and its really good, they are going great.

Why not java , why kotlin?
Java is great language and is keeping its promise of backward compatibility , you can run good old code with latest java sdk, due to its legacy code and to keep compatibility promise java can't add modern constructs to the core, it will always add things which are backward compatible. By using java libraries in kotlin, you learn java also. ;) And I believe in JetBrain, just look at their IDE's you will also!

Learning Kotlin given me several benefits such as :

  • No, compromise with awesome java libraries developed over decades, as they are supported by kotlin.
  • Modern features that can be implemented in dart as well.
  • Pretty soon android development is going declarative with JetPack compose(written in kotlin).
  • Makes me think how i can improve my idiomatic dart, with extensive resources to implement architecture patterns, modeling data, handling states, in kotlin.
  • The whole ocean of resources (Thanks to java/Android devs migrated early to kotlin).
  • All the java books , videos and other resources are valid in Kotlin.
  • JetBrains is not going be sued by oracle likegoogle.(xD)

MULTI PURPOSE

Kotlin Programming language use in real world.png

For Mobile Developers:

  • Official Android Language, new API's are kotlin first.
  • Can also build IOS APP using kotlin multi-platform mobile
  • Data modeling is a breeze using kotlin data classes with all the benefits without boilerplate i.e hashcode, == , toString etc.
  • 3rd party sdk's like payment gateways, offering idiomatice kotlin api's, if some lazy service provider not doing don't worry java api's also works same as in java.
  • No more NPE's (If you follow proper Null handling that kotlin provides).

For Backened Developers

  • All your Favourite Java frameworks are supported in kotlin.
  • You gets modern Web framework 'Ktor' (developed by Jetbrains) also for free.
  • Some top frameworks writing their new API's in kotlin for safer Robust code.
  • Spring , Micronaut and more fully support kotlin
  • 3rd party sdk's like payment gateways, offering idiomatice kotlin api's, if some lazy service provider not doing don't worry java api's also works same as in java.
  • No more NPE's (If you follow proper Null handling that kotlin provides).

For JS Developers

  • Kotlin/JS provides the ability to transpile your Kotlin code, the Kotlin standard library, and any compatible dependencies to JavaScript. The current implementation of Kotlin/JS targets ES5. Docs
  • With kotlinx-nodejs, you have typesafe access to the Node.js API directly from your Kotlin code. Docs

    For Native Developer

  • Kotlin not target JVM, JS but also Native
  • Kotlin/Native supports the following platforms:
    iOS (arm32, arm64, simulator x86_64) macOS (x86_64) watchOS (arm32, arm64, x86) tvOS (arm64, x86_64) Android (arm32, arm64, x86, x86_64) Windows (mingw x86_64, x86) Linux (x86_64, arm32, arm64, MIPS, MIPS little endian) WebAssembly (wasm32)

Kotlin is evolving as a platform , not just as language and having all the java infinity stones, developed over decades

Future looks good with kotlin, it opens new way of thinking to write code(null safe), gives you modern constructs (supported in other modern languages), which makes easy learning new tool for specific task or for adding new language to your stack.

Some useful resources to learn kotlin :

keep in mind, udemy stats:

udemyStats.PNG

Any Flutter Dev here: Start Learning idiomatic dart and see the difference

Himujjal Upadhyaya's photo

Kotlin might possibly be the best language for all around development. Its what a modern version of Java would look like. I worked on it developing Android Apps.

My complaint though is that Kotlin doesn't have a package manager of its own. Gradle is very heavy for basic projects. After working with pub, npm and cargo Gradle seems way too much. Hope JetBrains support this. Plus Kotlin support for Vim is pretty dull. Without Vim its hard to shift to Kotlin. I don't want to download another 1 GB, resource crunching IDE on my old laptop.

MOHD ASIF's photo

You are absolutely right, but it has to operate along with java on android so only way it can build projects along with java is gradle.

but apart from android kotlin can offer something lite.

Himujjal Upadhyaya's photo

MOHD ASIF

BTW appreciate your article.

Andrew Baisden's photo

This is exactly why I wanted to learn Kotlin to begin with. It can create apps across multiple platforms and it really is a modern version of Java. I am also learning Flutter and Dart. The Dart syntax is very similar to Kotlin and both are a joy to write with.

piyu jain's photo

Nice article, I started Kotlin yesterday day... Coming back to app development after 2 years. Hoping I understand it. App development is What I always wanted to do🤞🏼.

MOHD ASIF's photo

Welcome back, enjoy every bit of it. Kotlin is a gateway to many great things.