• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Kotlin Cookbook: Process of migrating to Kotlin

 
Ranch Hand
Posts: 135
5
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • 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: 151
6
  • Mark post as helpful
  • send pies
  • 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.
 
This will take every ounce of my mental strength! All for a tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!