Java or Kotlin

Discussion in 'Programming' started by Chokoladekiks, Jul 21, 2018.

  1. There are few of them, because the language appeared not so long ago and not everyone knows about its advantages.
     
  2. Well, I heard that it is difficult to switch to Kotlin from Java and therefore not much Java devs switch to it even considering its merits
     
  3. What's the problem?
     
  4. In fact, this is usually not the case, the languages are similar and you can find a lot of info on this.
     
  5. During development it doesn't fit, maybe I'll look afterwards.
     
  6. Fine, I'll bite...

    If your only criterion for determining the "goodness" of a language is convenient language features, then sure, Kotlin is better than Java. But then you should be pursuing languages like Python or JavaScript, in fact any dynamically typed and/or interpreted language, because they are far more convenient and much easier to write in than both Kotlin and Java. Why bother with Kotlin at all?

    Google is quite a convincing company that actively updates and maintains its projects... Is what people said about quite a few Google projects before they got left in the dust with a sole developer working on them in their spare time.

    JetBrains have explicitly stated that Kotlin exists to drive IntelliJ sales. They're not your friend and they're not doing this because "it's neat". The second the business model behind Kotlin begins to fail, they'll drop it like a hot potato. That said, Kotlin is pretty fucking solid these days, and unless Google can make Dart happen on Android via Flutter, Kotlin is probably a pretty safe bet for most applications considering how well it's doing in the Android community right now.

    There's a causal fallacy if I've ever seen one. If I know 99 languages, but Ruby ain't one, then chances are pretty good I'm not gonna get hired for that Ruby job opening. Being unique doesn't make you valuable - what a ridiculous thing to say.

    Being able to solve problems with the tools available to you makes you valuable. And sure, the more tools you know, the more problems you are likely to be capable of solving. But this argument goes for any other language. If Java is your only tool right now, Python and JavaScript will both leave you capable of solving far more problems than Kotlin will, and in vastly different areas too.

    And perhaps this is one of the biggest disadvantages. You'll hear people ramble on and on about how awesome some random ass language is, but there's usually pretty good reasons why they aren't as widely adopted as other languages. Haskell has been "on the rise" for almost 30 years. People keep saying "it's gonna be big!" but it never really takes off. D was gonna be the "C++ killer", and Go and Rust were both going to "make C redundant". They're all still pretty niche. Gaining popularity, but niche. Why is that?

    At the end of the day, your choice of language has consequences. They may be good consequences, who knows? If all you worry about is whether or not you'll be able to stream over a collection without first calling .stream() and then .collect(), or having to denote the type of a variable on the left-hand side of the assignment operator, then chances are something else that you didn't think about is gonna bite your behind. If you choose solely based on one quirk, I hope it's a hobby project and not something that has consequences for other people than yourself.

    Edit: I use Kotlin for almost all of my "service stuff" in my day job. I absolutely love the language. I also hate it with a fiery passion, because every single language feature is a double-edged sword, and when you work in a team, you can bet your 5-dollar ass someone in your team is gonna write some funky code that triggers more WTFs per minute than any Java code you've ever read or written.
     
    #47 garbagemule, Jul 18, 2019
    Last edited: Jul 18, 2019
    • Winner Winner x 1
  7. To add some nuance to that, it's not just sales. The same article you linked also states that they wanted it to improve their productivity.
     
  8. There are lot of all those new languages as I already said by the way
     
    • Agree Agree x 1
  9. I compare Java and Kotlin, not JS/Python
     
  10. It's enough to know 1 language and Ruby ain't one to not get hired for Ruby job, isn't it?
     
  11. I can understand this in case of JS, but Python? What do you mean?
     
  12. I actually have almost the same question, if they're better (what I doubt)
     
  13. Their productivity. The nuance is visible from a holistic perspective on the article itself - no doubt. But the point is the same: a company like JetBrains isn't going to keep something alive that they can't benefit from (business models aren't always purely about profit), so they are not a strong argument for "stability" in the discussion at hand. There's very little nuance from that perspective.

    You necro a one year old thread just to say "I like Kotlin better because it can do some things"? Your contribution to the thread is "+1". My comment is an admittedly cheeky, rhetorical question to your laziness - if all you care about is convenient language features, why stop at Kotlin? But you do care about other things, such as limiting the scope of the discussion to what makes your opinion look more relevant. I just think it's weird and I don't understand your intent.

    I don't understand what you mean by any of this, but I'm not sure clarifications will make the discussion any more interesting. Good for you that you like Kotlin. You do you, buddy!
     
  14. The nuance I was trying to add is that driving sales isn't the sole reason - improving their productivity is as well. I still completely stand by your point that if Kotlin doesn't work out the way they hoped (in terms of sales, or productivity improvement), they'd probably drop it.
     
    • Agree Agree x 1
  15. Actually I'm using Java.. But I learn Kotlin at the moment, cause I heard it will make the life of on developer easier:unsure:
     
  16. Strahan

    Benefactor

    [​IMG]
    Oof. I'm gonna blow your mind...



    :D
     
    • Like Like x 1
    • Funny Funny x 1
    • Winner Winner x 1
  17. I heard Kotlin has epic asynchronous abilities, is this true? (I have little to no experience with Kotlin)
     
  18. Kotlin has coroutines (which compile down to state machines on the JVM), which are really cool. Other languages like Python or JavaScript already have them as well so you've maybe seen them there (async-await and generator functions), and Java is going to get them in a future update (probably a long way ahead though...). Essentially, they allow you to deal with callbacks in a very elegant way.

    For example, the following Java code
    Code (Java):

    someAsynchronousMethod((A a) -> {
      someOtherAsynchronousMethod(a.c, (B b) -> {
        // do something
      });
    });
     
    would look like this:
    Code (Java):

    A a = await someAsynchronousMethod();
    B b = await someOtherAsynchronousMethod(a.c);
    // do something
     
    The two are the exact same (functionally) - which means the execution thread isn't paused or anything (so it's not just fake synchronous requests). Pretty neat!
     
  19. Rasputin vs Katyusha