Kotlin VS Java

Language comparison: is it worth to move from Java to Kotlin?
18 August 2017   3299

Java is a language that has become one of the standards for business. Thanks to its multifunctionality, backward compatibility of versions and cross-platform software it is suitable for almost any task, such as the development of large portals and online stores, the creation of mobile applications, the work with corporate programs.

However, every coin has two sides. Thus, here 's a negative side to enterprise-oriented Java: the need to support all the existing projects at the time of the release of new versions seriously hinders the development of the language. You also have to wait for the appearance of plenty of important possibilities like first-order functions for years.

The JetBrains company was not happy with such state of affairs, so they introduced their own JVM-compatible language - Kotlin, -  back in 2011. Let's find out what are its disadvantages and advantages in comparison with his "parent".

Java vs Kotlin code Java vs Kotlin code


Moving from Java to another language is always a problem, often insoluble, especially when it comes to a large and old projec, as it is almost impossible to rewrite it entirely at a go. That's why Kotlin can be built into any existing Java code. This will allow the user to immediately continue to work on the project on Kotlin, step by step rewriting its old Java-parts.


The main task that JetBrains set for itself was to simplify the language and to finally solve some problems that  caused discomfort even to experienced Java programmers.
In Kotlin:

  • The declaration of the variables and the creation of objects are simplified.
  • There's no need to explicitly specify a type for the variables.
  • There's a support for string templates that allow you to use dynamic data and method calls right inside the line.
  • There's a set of tools that simplify and accelerate the writing of code for Android-applications. For example, you can access all the views with a unique ID in XML markup by adding just one line in the import section.

Additional Features

Kotlin uses several additional features that speed and simplify the process of writing code and give the developer a greater arsenal of the programming tools:

  • Lambda functions that reduce the amount of code that needs to be written several times.
  • Higher-order functions that allow taking functions as an argument and return the new functions.
  • Operator overloading that simplifies the call of the functions and allows using several variants of using operators with the same names in one scope.

Kotlin in general is focused on functional programming, thus, it is likely that there will be the support for other functions in the future. 

Speed of work 

The tests conducted usually show that the first assembly of the project on Kotlin is 10-20% slower than the similar on Java. However, this type of compilation is rarely used, while when carrying out more popular incremental assemblies, Kotlin as a whole shows no less speed than its "parent" and in some cases even slightly exceeds it. Therefore, it can be said that this language is not slower than Java.

Error protection

The emergence of the NullPointerException error disturbed even experienced Java developers and made it take a long time to figure out the reasons for the error and fix them. In Kotlin, the null and non-null types are additionally used, so it is impossible to write null and perform the operations leading to NPEs.

Expansion Capabilities

Kotlin is quite flexible and allows the programmer to add features missing specially to him without any special problems. To do this, the extension functions are used. Thus, you simply need to specify the prefix of the extensible type and apply the resulting function to any list. There's a possibility to add new features to both your own classes and the standard ones.

Documentation and the Community

On the Java's side there are several decades of active use and many implemented projects including quite complex enterprise applications. The low rate of the changes'occurrence also makes numerous solutions published in the community two or three years ago still relevant.

Kotlin can't boast of such an amount of available information, however, JetBrains documentation is quite well-developed, while the orientation to business structures increases both the number of programmers working with the language and its popularity in the thematic communities.

The Conclusion

In favour of Kotlin:

  • Rapid development and the emergence of new features that can not be implemented in Java.
  • Simplifying of the code writing.
  • Functional programming orientation.
  • Excellent extensibility.
  • Protection against NullPointerException.

In favour of Java:

  • A widely recognized standard in the development of enterprise applications.
  • A large fully formed community.
  • Slow development saves the developers from "race for technology".
  • Plenty of specialists mastered the language.

What technology do you choose, Kotlin or Java?

What programming language do you prefer? Kotlin or Java? Or maybe you are already using some of them? Please, share your thoughts with the community. Also, after the voting, you will be able to see what people like the most. Your opinion is very valuable for the Hype.Codes team.

Canonical to Represent Minimal Ubuntu

New version of Ubuntu is created for servers, isolated containers based on Docker and cloud systems
12 July 2018   105

Ubuntu team presented a simplified version of the base image - Minimal Ubuntu. It is designed for servers, isolated containers based on Docker and cloud systems. The release features high performance, minimal load time and automation of applications in the cloud.

The small footprint of Minimal Ubuntu, when deployed with fast VM provisioning from GCE, helps deliver drastically improved boot times, making them a great choice for developers looking to build their applications on Google Cloud Platform.

Paul Nash

Group Product Manager, Google Cloud

The authors of the project emphasize the size of the distribution kit, which "weighs" 157 MB, and also supports the main cloud systems like Amazon EC2, Google Compute Engine (GCE), LXD and KVM / OpenStack, each of which has its own optimized version of the package. In addition, the OS-based image for operating with containers based on the Docker platform, compatible with the Kubernetes.

Minimal Ubuntu is designed for automated execution, so it includes only a minimal set of tools. The distribution can be upgraded to a set of Ubuntu Server packages using the special utility "unminimize", which returns components that are convenient for interactive management.

According to Canonical representatives, the deletion of the manual control functions resulted in the acceleration of the load time by 40% and the reduction of the occupied disk space by 50%. At the same time, this release remained completely compatible with all the packages from standard Ubuntu repositories. Required packages can be installed using the standard package manager apt or using snapd, which are included in the distribution by default.

Two assemblies are available for download, based on Ubuntu 16.04 LTS and 18.04 LTS. You can download them on the official website.