• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Kotlin, are you using it?

 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using Kotlin or learning it? It does have some fairly neat features like "==" being the Java equivalent of the "equals" method, data classes, final classes by default and more.
From the documentation that I've read, the designers have tried to put into practice many of the concepts from the "Effective Java" books to make development better/easier.

I've used Kotlin for Android development on a project found in the "Android Programming: The Big Nerd Ranch Guide (3rd Edition)" book.
Hopefully within the next day or two I can use Kotlin as I try to learn how to use Spring Boot to create some web services.

If you are learning Kotlin then what are you plans for using it?
If you are using Kotlin then what are you using it for?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've used it to write a small tool at work to analyze files that I'm working with. Not for Android programming, just for use on my development machine.

Kotlin has a lot of interesting language features. One of the features that I find quite useful is extension methods. With extension methods, you can, as it were, add extra methods to existing classes. For example, in Java we often use "utils" classes for utility methods - a number of libraries, including Apache Commons Lang and also Spring, have a StringUtils class with extra utility methods to work with strings. With Kotlin extension methods, you can write these as extension methods so that you can call them on String objects as if they are defined in class String itself. This makes these methods integrate much better with existing code, because you can use the same syntax to call them as any other method that is in class String itself.

But there's of course much more. If you are using Kotlin with Spring, then check out the newly released Spring Framework 5, which has official support for Kotlin.

Looking at the language, I can see that Kotlin has borrowed features from a range of different other programming languages - syntax that looks partly like Scala, extension methods from C#, data classes that look a lot like Scala's case classes, pattern matching, things that look like they come from JavaScript, etc.

It's worth it to take a look at if you are a Java developer, even if it's just to get a fresh view on programming languages and learn some new features and constructs that don't exist in Java, so that you get an idea of what's possible beyond Java.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:If you are using Kotlin with Spring, then check out the newly released Spring Framework 5, which has official support for Kotlin.


Thank you Jesper, I was not aware of that.
I have much to learn regarding both Kotlin and Spring.
 
Ranch Hand
Posts: 607
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
kotlin allows a gradual approach, is java under the hood. I am using it. But one thing is to use it, another one using idiomatic features..
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:kotlin allows a gradual approach


I know, you can have both Java and Kotlin files in the same project and you can call you Java from Kotlin and you Kotlin from Java.

Giovanni Montano wrote:But one thing is to use it, another one using idiomatic features.


On of the features that I really like is Kotlin Data Classes. With only one or two lines you can setup a POKO which acts as a POJO that has all of your getters, setters, toString, equals, hashCode.
You can even provide default values to the data class which will show up as overloaded constructors if you use the @JvmOverloads annotation on the data class as noted here https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-overloads/
However you are not limited to what is created, you can create your own getters, setters etc if you need to have that fine of control.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic