24
plokko
5y

Kotlin
All the languages have a basic objective in mind that shapes both the language and it's community:
for c/c++ was low level hardware access and performance, for Java OOP and learning; Kotlin was mostly made to make dev life easier and tries to anticipate what you want to do instead of forcing his patterns and tries to help you instead of punishing errors.
As a dev at least i feel a little more cared about and less left alone (especially in the ugly world of Java for Android)

Comments
  • 1
    @irene no it's magic! It has deep integration with the ide and precompiler so most of the repeating and complex stuff are done behind the scenes and to make the code more readable; for example you can extend base classes like js (ex add an md5 function to String) and for an api is a LOT more simple to make them readable (see inline lambda).
    It is indeed a very different language but a very woth investment
  • 2
    (0..100).forEach {
    this.rant.++()
    }
  • 2
    Doing that may make your life easier but it's only okay if you know what's happening behind the scenes in terms of the stuff that is precompiled. Since Java verbosely shows the stuff, you know which listener to use with which view, which constructor to use etc. I feel that is more important for someone doing app development on his own. It'd make sense to use Kotlin if your part of a tram of coders who have implement a flow chart.
  • 1
    @iamgio
    Repeat (100) { this.rant.pp() }
  • 1
    The folks at Intellij are awesome. They openly accept that they took all good ideas from different languages to make Kotlin really enjoyable. They took concepts from C#, python, go etc to make Kotlin less verbose and more practical to use. The interoperability with Java just makes it a breeze to use with any of the vast number of libraries available in the Java ecosystem.

    Give it a try folks. You'll really start hating Java after that.
  • 0
    @badcoder any good start for that?
  • 1
    @plokko I don't think languages should learn inheritance from JavaScript or in fact, no one should.
  • 0
    @KennyTheBard search for the Kotlin koans :) By the way, the best way to learn Kotlin is by using IntelliJ. Often it goes like this.
    Me: writing some nice implementation in Kotlin, with a new approach I just learned from Kotlin.
    IntelliJ: You can write this in an easier way. Simplify.
    Me: damn, it's even shorter now :)
  • 0
    @KennyTheBard Kotlin in Action is a good book if you are into reading books.

    The docs are well organized too. I just delved into the tutorials with Intellij. Have a look at "Awesome Kotlin" list. There's tons of resources there.
  • 0
    Good thing that i already comf with IntelliJ, i will def look out for those books, thank you both!
  • 0
    @D-cyde i do disagree:

    we're not talking about a framework but just a new language that make the code more concise and less prone to error.

    It could be a 1:1 match (Kotlin do actually transpile pasted Java code);

    the only things that changes from Java may be a more concise and readable code for repeatitive task and null checking and if you do program in Java you know the pain of a nullpointer exception while Kotlin easly makes you check or resolve them before even firing the compiler.
  • 0
    @plokko I feel I have a lot learn in Android before I am comfortable with skipping to write View.OnClickListener altogether. NullPointerException can be easily mitigated in Java by double checking your code and using null checks. On the off chance I feel the code is getting too verbose I just use code completion. It may be well suited for coders who have to implement a given flowchart but for the guy just starting out in Android, Java is better.
  • 0
    @D-cyde Well if you want to code in Kotlin you need to know Java, Kotlin do help a lot but you need to know what you're doing but if you do i feel it's great even for small tasks.

    btw it's not that easy to check everywhere for nullpointer exceptions, sometimes in big Java programs it's easy to skip some checks, Koltin asks you to fix them BEFORE even compiling and it's a huge difference in time consuming tasks; also Java code is very bloated and ask you to repeate stupid checks like variable types when the compiler already know what to expect, Koltin is a lot less verbose.
  • 0
    I wonder how many devs actually do null checks even when the IDE shows it as a warning. Almost every dev i have met till now has this tendency of ignoring warnings.

    I have made it a habit to not leave a single warning in my Java code. But honestly it makes the logic hard to understand because of all the checks. So Kotlin forcing users to never do nulls is indeed a great thing. I would argue anyone who has worked on large java projects with a lot of team members would love this. No more poking devs to be vigilant and do null checks.
Add Comment