Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic