publication

What is Kotlin? Learn in 15 minutes

Miquel Canal

Wednesday 28, April 2021
  • Backend
  • open-source

Introduction to Kotlin

Kotlin is a programming language that is rapidly increasing in popularity, that is why it is a positive choice to learn in 2021. It is often referred to as the Java alternative bringing big advantages for JVM (Java Virtual Machine).

Kotlin can take an object-oriented approach as well as functional programming. This is a key benefit as it supports the main features of functional programming. Kotlin also has a relaxed approach to function declaration allowing anonymous functions or at a top file, outside classes.

Kotlin is a typed language. It allows you to use val and var to initialize variables when the type can be inferred. For all other cases you must declare the data type.

Kotlin: a server-side language

Kotlin is a server-side language which has full compatibility with Java. It can easily pair with Spring making it a great combo for application development. It can also be compiled into other platforms such as web in JavaScript or mobile native.

The key to work with Kotlin is to maintain a single code base and be able to compile for multiple platforms. The compilation process varies based on the destination platform. As example: when targeting the JVM, Kotlin is compiled to JVM *.class files, which is a bytecode format that can later be either interpreted by a JVM.

What is Kotlin Multiplatform Mobile?

One of the main benefits of Kotlin is its cross-platform development. You can maintain a single code base while producing mobile applications for iOS and Android. The business logic of your code can be reused on each platform.

Kotlin uses its mobile SDK Kotlin Multiplatform Mobile to reuse code across mobile platforms. If your project requires any native operations, you can easily use the expect/actual pattern to seamlessly write platform-specific code.

Using Kotlin for cross-platform code does not require addition of new programming languages. Its syntax resembles android and iOS, so mobile developers can easily catch up with the app development process.

Kotlin in frontend JavaScript applications

Kotlin can also be used to develop frontend web applications in JavaScript. Using Kotlin/JS you can transpile your Kotlin code into JavaScript and perform frontend tasks such as: DOM modifications, Canvas rendering, development of WebGL components and more.

Kotlin/JS framework also allows to create ReactJS applications by using Kotlin wrappers. These wrappers provide integrations with the most popular JavaScript frameworks. Another usage of Kotlin/JS is to integrate with Node.JS and develop web applications that render on the server-side. This allows for executing applications in a JavaScript runtime engine.

Kotlin/JS also integrates well with TypeScript language. This allows for creating TypeScript libraries in order to reuse code on future applications. You are also free to reuse existing Kotlin/JS libraries provided by third-party developers in Kotlin’s open source community.

References

SQL Joins, Group and Union

SQL Joins, Group and Union

Overview of the SQL Join clauses: Inner, Left, Right and Full joins. How to join two or more database tables and how to group them using Group By. What are aggregate functions in SQL and how to Union multiple SQL queries.

Flutter for Beginners: What is Flutter?

Flutter for Beginners: What is Flutter?

Flutter is a multi-platform framework built by Google and used to develop native applications for web, mobile and desktop from a single code base. Here we review key ideas, concepts and introduction Tutorials to Flutter.

Introduction to Dart Programming Language

Introduction to Dart Programming Language

This article covers the basics of Dart, a programming language developed at Google. With a C-style syntax, Dart can be used to develop mobile apps, web application as well as desktop applications. The first step to learn Flutter is to understand its base.

This site uses cookies to ensure a great experience. By continue navigating through the site you accept the storage of these cookies.