• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Spring Boot: Up and Running

 
Ranch Hand
Posts: 506
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I'm wondering why you include both Kotlin and Java in the discussion of building microservice applications ?
I'm used to this with Android documentation and was wondering if we are now going  the  "switch to Kotlin" path with server side applications .

thanks,
Paul
 
Author
Posts: 8
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Spring is to large degree language-agnostic when it comes to Java vs. Kotlin. The goal is 100% parity between the two languages, and it's very close. Practically speaking, all Spring components are developed in Java, and Spring APIs for Kotlin are often more elegant owing to Kotlin's DSL capabilities...so it's a bit of give and take.

I don't think Java will be supplanted fully by Kotlin, ever. But it's a great thing to have options, and Spring Boot and other Spring libraries are easily consumed and leveraged from both, which is nice for shops which don't embrace both but strongly prefer one over the other.

Cheers,
Mark
 
paul nisset
Ranch Hand
Posts: 506
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shops which don't embrace both


As someone who maintains applications/web sites, I really hope it doesn't come to mixing both in the same app !

thanks,
Paul
 
Mark Heckler
Author
Posts: 8
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

There really isn't much to it to use both in the same app...both compile to the same bytecode and Kotlin coexists really nicely with Java code, even within the same project. For fun sometime, take a small sample Spring Boot project and use the Spring Initializr (at start.spring.io) to create a project with the same dependencies, but selecting Kotlin as the language. Then preview the pom.xml / gradle.build.kts, copy the Kotlin-specific material from that and paste into your sample project, and rebuild it. No changes, still Java code, but the project can now compile Kotlin sources.

Then convert a (or multiple) Java domain class(es) to Kotlin and rebuild the project. You'll likely need to adapt a few calls to accommodate the change in constructor(s) (assuming you fully embrace idiomatic Kotlin), but otherwise, everything works brilliantly.

So it's possible, and not even problematic in most cases. But you're right, not something you're likely to see very often.

Cheers!
Mark
 
Mark Heckler
Author
Posts: 8
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Caveat: I really wasn't originally referring to shops that use Java and Kotlin in the same app, but rather those shops that may allow development teams to choose their language per project and thus end up with both, depending upon the team/application. The previous answer was just to demonstrate that mixing both languages together in the same project really isn't that big of a deal, and not to necessarily encourage that become the norm.
 
paul nisset
Ranch Hand
Posts: 506
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

No changes, still Java code, but the project can now compile Kotlin sources.



Thank you Mark.
The inter compatibility is pretty interesting and probably useful in some cases.

My thoughts were in  terms of mature apps and ongoing maintainability . It is probably easier to find/hire a programmer that knows one language rather than two.

 
 
Mark Heckler
Author
Posts: 8
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll get no arguments from me there. Thanks for the questions, comments, and just generally great discussion Paul!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic