Win a copy of Head First Android this week in the Android forum!
  • 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 Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Kotlin Cookbook: Process of migrating to Kotlin

 
Ranch Hand
Posts: 135
5
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ken,

I have been working with Java for around 5 years so far. I saw how the language has changed to catch up with newest programming language trends and enhance the power of Java itself. They even changed their lease cycles which they thought to be a solution to hook up the existing language users. But I think Kotlin has geared up with most up-to-date tools within the language core itself. My question is, does your book covers how I can start thinking of using Kotlin to my existing projects? Because I know some big companies have already started to adapt to Kotlin but they have started with their Unit tests. I would like to know is this aspect has been covered in your book. I think it's a very practical usage to try out any new language(JVM languages) for an existing project.  

Best regards,
Jude
 
gunslinger & author
Posts: 158
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jude,

In terms of testing, I have several recipes that show how to write JUnit tests with Kotlin, which can test code written in either Kotlin or Java.  (You can find an annotated listing of all the recipes here).

Mixing Java and Kotlin in the same project is easy. In fact, every Android project already does that, because the Android SDK itself is still written in Java, which shows Kotlin classes can extend Java classes, or implement Java interfaces, and so on.

So adding Kotlin to an existing Java project is certainly doable. Add the appropriate Kotlin dependencies to your build tool and go from there. The GitHub repository for the book is a mixed Java/Kotlin project. I was planning to add a handful of recipes specifically on integration, but (1) I ran out of time and (2) it's actually easy enough that it hardly required recipes for it. Just instantiate the classes from the other language and invoke their methods as usual.
 
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