Have you heard of kotlin? It’s a relatively new language officially launched in 2016 by JetBrains. They originally created the language as a more flexible and expressive alternative to Java, with the ability to run on top of the JVM, allowing developers to use kotlin and java code interchangeably in a project.
Since then, a lot has happened, kotlin can now do a few extra tricks:
- It is officially supported on Android (and Android Studio) since Google announced it on the Google I/O of 2017.
- Trans-compile to javascript (as CoffeeScript or Typescript do)
- Run without a VM using kotlin native
- Run on top iOS and mac os with interop with Objective-C
I started learning kotlin not too long ago and found it quite interesting the way it handles things and the expressiveness it adds in an environment known for its verbose nature. The more I learned about the language, the more I enjoyed it. So I decided to share my thoughts and experiences with it by writing a mini blog series that can expose the language’s pragmatic nature and philosophy.
I hope this serves you as much as it has to me and even if you don’t end up using it, at least you can take with you the kotlin way of thinking.
Let’s dive in
Kotlin has numerous features some you can find in other languages and some other are very unique to kotlin but what all of those feature have in common is the promotion of concise and expressive code as part of the language philosophy.
I’ll leave here the table of contents with a brief description of what you will encounter. Feel free to read it in any order you prefer.
Unfortunately, not all posts are available yet since this is an on-going series but you are welcome to read those that are ready. I’ll be posting the updates here and twitter, so don’t forget to subscribe.
- Variables and types. Variables in Kotlin are a bit different from what we are used to. Here we are going to explore the difference as well as the type system used and how it compares to other languages.
- Arrays and collections. We use data to interact with our application and the way we do that is using arrays and collections. In this section, we will learn about the particularities of these data structures how and how to take the most advantage.
- Nullability. Nullability is a very interesting topic on kotlin, mainly because unlike other strongly typed languages, it doesn’t allow null values out of the box protecting your code against the famous NullPointerException
- Operators. Every language has operators to express logic in a straight-forward way. Kotlin uses the one we are used to in C-descendants languages and also provides a few of its own.
- Flow control and loops. If you have been programming in any other language you must be used to flow control and loops, on kotlin we add a little sugar on top to make it even more expressive and easier to read.
- Classes and Object Oriented Programming. Have you developed in _any _OOP language you surely will feel comfortable with this topic *but * as usual, Kotlin take this a bit further with composable objects, default implementations and even simpler ways to express and declare classes.
- Generics. Have you used a collection of a particular type? Something like Array<String>? Here we will learn how to use a template on your class that you can pass a type later on to provide extra flexibility and reusability, and just like collections, you will feel you have multiple classes and only wright one.
Top comments (0)