Kotlin implementation | Part 2


Developer Insight

Nov. 13, 2017, 3:55 p.m.

In our previous article we've shared a developer's insight about Kotlin implementation. We are glad to share further answers in the second part of this article. 

No need to wait any longer. Let's start!


In fact, I realized that a new language would require a new development environment. 
And that is moment when questions have appeared like: 
1) How much does it cost? 
2) How long developer will  learn to interact with it?
3) How much time is needed for developers on Java to use Kotlin code correctly? 
4) How fast investments will paid off? 


Adding Java code to an existing Kotlin project does not present any difficulties. In Android studio 3.0 Kotlin support is by default. For earlier versions, this issue is solved by adding a plug-in from the company JetBrains. As it has fully two-way compatibility of languages some part of a project can be written on Java, another one  - on Kotlin without any damage to the work.
Thereby, Kotlin introduction into a project does not obliged to anything. There is no need to refuse from Java and no need to switch on a new language  immediately. 
There are no difficulties with supporting old projects. 
Based on personal experience switching to a new programming language won't very difficult and can take 2-4 weeks for junior-level developer.

The first stage with Kotlin comprehension - is a study of its basic syntax, or rather, its differences from Java. 
This allows you to write, in fact, all the same code as before, only in a different language.
To some extent, this is not a correct approach, because developer while using a new language, continues to be guided by the idioms of the old one.
Nevertheless, this is an obligatory intermediate period,  which pass all of us. 
Already at this stage code becomes more concise and readable.
According to the personal experience, the amount of written code becomes less in 1.5 times. 


Further, there is a more in-depth acquaintance with the new opportunities that Java lacked so much -  whether it new opportunities for working with collections, delegates or higher-order functions, etc. At this stage, the amount of code has already been decreasing at times. 
Also, writing complex pieces of logic often requires less thought and less work due to the use of ready-made language tools. In further work, developer comprehends more specific and less commonly used language features. 
At this stage,  often comes the realization that Kotlin capabilities were not used fully and the code can be further optimized. In certain cases, the code can be reduced in dozens times. 
It becomes clear that return to Java after Kotlin - is the same as move from Android Studio to Eclipse.


The biggest problem for me in the matter of studying the pros and cons of this transition is the search for case studies for this language implementation in outsourcing companies that used to work mainly with Java. There are almost no such cases. But the existing cases  are more looks like not a story about how it was, but advertising itself like - "Look! We have Kotlin! We are in a trend .. "  and by this related to this  language development  information ended.

The process Kotlin integration into Android studio and its active implementation in the development of mobile applications has really started not so long ago. It's quite natural that there are some minuses, shortcomings and a small amount of information about it. Someone, maybe, will be missing the familiar Live templates for Java, for someone else will find another problem. But, do not forget that in this respect, Java has the advantage with a few years, while Kotlin is only at the beginning of its journey. And, given the rapid growth of interest in the new language and the pace of its development, all the shortcomings and roughness associated with its implementation in the development, will be eliminated quickly enough.


In the End

Needless to say, that a new language transition disadvantages are incomparable with its advantages for both developers and project managers. 
As repeatedly said Andrey Breslav, Lead Language Designer and  Kotlin Project Manager at JetBrains, their task is to simplify the life of developer. And they are very good at it. 
Using Kotlin will improve code readability and reduce coding time. In generally that increases the productivity and quality of a programmer's work (and this is already a weighty argument for project manager).
JetBrains team doesn't stop at what they have been achieved and the language continues to grow into new opportunities. For example, Cotoutines that is under development stage now. 
At the moment, developers have an opportunity to use it in the project as a separate library. Company collects statistics and user reviews to make a finished product as thoughtful and convenient to use as possible.
It is also necessary to take into account that moment, that JetBrains hasn't developed a highly specialized language exclusively for Android development.
Before Google IO 2017 a percentage of web and Android developers using in their work Kotlin
was approximately the same. And at the moment Kotlin usage continues to expand both in the field of Android development as well as web.
Besides it, Kotlin/Native is under development now ( in the end of June 2017 was presented 0.3 version). With its help developers can code without  JVM or another virtual machine that is able to compile into executable files for Windows. So, the language is fairly confidently spreading into various areas of development and definitely deserves attention. 
Companies like Uber, Evernote, Atlassian, Facebook, Pinterest, Yahoo, NBC News, Hudl, PSPDFKit, Groupon, Basecamp, Keepsafe  and many others had already been using it. 

Please feel free to contact us with any questions hello@rollncode.com .