Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Should I move to Kotlin?  RSS feed

 
Mohammad Hamed
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
Sure you heard about Kotlin and using it instead of Java to develop Android Apps.

My question is:
Should I move from Java to Kotlin now?

I have been using Java to code for Android for more than 2 years now but I heard a lot of good things about Koltin, will it be the official developing language for Android instead of Java?

Thank you in advance.
 
Tim Moores
Saloon Keeper
Posts: 3902
91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will it be the official developing language for Android instead of Java?

It is an official language, given its support in AndroidStudio, but not instead of Java but rather in addition to it. Given the amount of Java code for Android out there, and the fact that Kotlin is a variant of Java rather than something entirely different, it seems safe to assume that Java will continue to be supported.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:... and the fact that Kotlin is a variant of Java rather than something entirely different

I wouldn't call Kotlin a variant of Java - it's a different language, with different syntax and lots of features that Java doesn't have. It does of course compile to JVM bytecode, but that doesn't make it a "variant of Java" either (lots of other languages that are not like Java at all compile to JVM bytecode).
 
Andy Crowther
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been wondering about this too.  I started learning some Java about 4 months back.  After a month I moved on to code in Android Studio, so have been doing that around 3 months now and I wonder if I should start learning Kotlin, rather than continuing to learn more Java?

I've heard Kotlin is a little easier?  I guess I worry there isn't as much searchable info about Kotlin yet?  When I come across a java based issue, a quick Google will find someone 6 years ago that had the same problem and someone posted a fix.  Is the resource there already for learners of Kotlin?

I just tried searching 'kotlin change integer to string' and 3 years ago it was answered.  Maybe I'm answering my own question here.  It looks quite nice too...

 
Giovanni Montano
Ranch Hand
Posts: 422
7
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys, first java then kotlin. I would no recommend to start with kotlin.

we have a beautiful forum for koltin I suggest to move it to this section as today kotlin equal android. Next year could be also spring boot java, but doubt scala is really strong on the backend

Kotlin is official, I can tell you that all the coders I know in the netherlands are using kotlin now to code android.
Also nobody uses AsyncTask anymore please stop to send example with them if you can.
Also everybody I know that do android since more than one year uses Dagger2, Retrofit, RxJava2, Butterknife.

Kotlin is not easy as people present, has a steep learning curve if one want to go over the `?` no pointer exception operator\and data class.

For example concept as companion object, coroutines, declarations are not easy at all, and the 1 to 1 conversion from Java to android studio is not optimized, and once you do the conversation and start to refactor adding new features you cannot go back anymore. Also there are some reasons I cannot share because would be against the policies of the forum that clearly show that in one year will be impossible to do android without kotlin, at least if one want to work in a team.

For instance I found a NPE in a top 10 app in google play, and I discovered that the main class was more than 5 thousands lines this is against all the common sense as nobody do classes so long anymore, but still exist and work, same for Kotlin, no way to find a job in the future if you do not know it
 
Liutauras Vilda
Marshal
Posts: 4670
320
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giovanni Montano wrote:Kotlin is official, I can tell you that all the coders I know in the netherlands are using kotlin now to code android.

Kotlin just very recently became officially supported Android language, but I'm doubted it is up high in the sky yet with mobile development from the users point of view, but it might getting there and might will overcome Java at some point as it has more "modern" languages features which let's you write more concise code. In fact Kotlin is way more similar to Scala than Java from this point of view.

But the journey of Kotlin towards the Android Olymp isn't going to be easy I think as there is such framework as React Native (which is JavaScript in essence), which is very popular among the programmers I know, who specialises particularly in mobile applications development. As a main productivity advantace is claimed, that you write code once, and can build it to Android or iOS mobile apps.


@OP
Now about your case. With Kotlin (as well as with Scala) you can write programs in Java style and the code will look almost the same. But that wouldn't be an idiomatic those languages way of doing things, hence wouldn't be a good idea to use the tool not in the way it was built to. Kotlin as well as Scala (but might let's stop with Scala right here as you particularly asking about Kotlin) are further down the functional paradigm route than Java is now. From this point of view, I think it is an advantage to be able to use more modern language features so you'd sooner get used to that style.
Big question is, if Kotlin will ever become a general purpose language used outside mobile development (they claim that, and I know in industry is used already, but not so much at least in UK). But at the same time, once you know Kotlin, would be way easier to pick up the same Scala, or Swift (if you ever want to go to iOS development), or Java, which also has functional programming aspects and might in a future will have more.

So to conclude, if you are in particular interested to Android development and need to choose either Kotlin or Java to start (from scratch), I'd go probably with Kotlin. But hey, you'd know Java too up to a high level in my opinion, so any time for any other non-mobile development if you'd want or would be required, you could easily pick up Java.
 
Liutauras Vilda
Marshal
Posts: 4670
320
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to say, Java is probably easiest of those mentioned languages to learn and more intuitively come up with things.

Newer languages have a lot good features, but at the same time adds way more confusion, because if in Java you were able to do some things in 2 or 3 ways, now you can do same in probably 6 or more ways, and those idiomatic ways aren't so easy to pick up at first, especially if you are coming from Java world, unless you were also had a chance to program in some functional language in the past.

You can sometimes think, ok, why I need that concise functional code with higher order functions, closures if I can write in old Java style (if don't want to learn Java 8 features) the same, just with few more lines and with less methods/functions to learn + Java has big community as well as very good documentation.

So, there is no easy answer.
 
Giovanni Montano
Ranch Hand
Posts: 422
7
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Liutaras when you learn Kotlin do not want to go back to Java, much faster reading the code. This is what everybody say to me and I would agree, expecially if you work with people that do SWIFT. Then I make mention there are other reasons, I am speaking from a business point of view, but cannot touch them because of the rules forum.

React Native is EVENTUALLY  going to take over android and ios native in 5 years. And also then is not sure, at the moment not too much documentation, no performance, no complexity
 
Liutauras Vilda
Marshal
Posts: 4670
320
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giovanni Montano wrote:React Native is EVENTUALLY going to take over android and ios native in 5 years.

Well, we don't know that. What we might could assume, that it is going to take his piece of the pie. And that piece probably will be eaten mostly by the modern web developers who uses AngularJs, Node.js, React where JavaScript is a key and they are used to it well, so the learning curve possibly would be fairly easy.
 
Giovanni Montano
Ranch Hand
Posts: 422
7
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:
Giovanni Montano wrote:React Native is EVENTUALLY going to take over android and ios native in 5 years.

Well, we don't know that. What we might could assume, that it is going to take his piece of the pie. And that piece probably will be eaten mostly by the modern web developers who uses AngularJs, Node.js, React where JavaScript is a key and they are used to it well, so the learning curve possibly would be fairly easy.

Interesting, from one side one could think JS devs, but from another side a mobile engineer with expertise on Ios or Android can manage legacy code, and know how to make working the mobile in a much more difficult way, so that native reactm stuff become much more easy. After all if you are going to use JS to make it work with mobile, you have to use existing mobile technology for ex, you can use JS as much as you want but if you need to trigger a Toast
ToastAndroid.show('I am a toast in JS!', ToastAndroid.SHORT);


still you have to go trough the method show, the same used in Java for instance. Method that an android dev knows, a JS dev not.
 
Dave Tolls
Rancher
Posts: 2914
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As with devs in other languages, JavaScript devs are used to using APIs, so would treat the Android side of things as simply another API to interact with.  After all, that's what I've done when I've written Android code in Java.

These other languages (Kotlin and React Native) are not (IMO) there to replace Java, but there to expand the pool of available devs.  As far as Google is concerned the more people who can write apps for Android the better.
 
Liutauras Vilda
Marshal
Posts: 4670
320
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:Big question is, if Kotlin will ever become a general purpose language used outside mobile development (they claim that, and I know in industry is used already, but not so much at least in UK).

A bit off main topic, but this recent ad on LinkedIn shows, that Kotlin sounds more and more good promising.
Recruitment agency ad wrote:BLOCKCHAIN - We're looking for developers to join one of our fastest growing FinTech clients in the City. Salary from £50k-£100k + Bonus

The tech stack is actually outside of .Net, they're using Kotlin but are happy to cross-train .Net Developers into this language as long as you'd be happy to work with it. Kotlin was released in April and is a language that could be very well received this year.

Please get in touch asap if you're keen on learning more.

I was in Kotlin Night conference organised by JetBrains at the end of last year, recording here, so there were speakers who actually use it in industry already.

So once again, I think it is worth getting introduced yourself to this language, it can be rather beneficial than otherwise.

And I agree with Dave, despite the fact, that we can quite often hear complaints about Java, need to admit, that Java is still language no. 1 for the past 15 years according to Tiobe Index (I see there were a big drop recently though) and any replacements doesn't seem to happen anytime soon.

It is good that new languages appear bringing new features, I believe that keeps moving Java and other languages forward.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!