Java to Kotlin: A Refactoring Guidebook

Praise for Java to Kotlin

On GoodReads

⭐️⭐️⭐️⭐️⭐️

Great book. Title doesn’t make justice for it. Don’t be afraid that you are beyond the Java -> Kotlin transition. The book is so much more than that.

You will learn how to use Kotlin effectively and in a idiomatic way, leveraging it’s tools like functional programming, top level functions, extension functions etc You will also take a peek on how to test drive your way and quite a bit of refactoring techniques. Totally worth the read!

— George Theocharis, August 2022

⭐️⭐️⭐️⭐️⭐️

This is a great piece for every Java programmer who thinks about trying out Kotlin. It doesn’t cover every language feature and is by no means a replacement for the reference documentation, but it is something more important in my opinion. As rarely (if ever) in the real world there is a chance to suddenly migrate your project from one language to another, it is crucial to know how you can do such a thing incrementally and where it may bring the most value for your buck. And this book pretty much gives you just that.

I also really liked that the authors put a lot of focus not only on the language itself but also generally on best practices of software development and functional programming especially. The examples are rather simple, but they convey the message pretty well. The text is easy to read and understandable. Overall, I can truly recommend this book.

—Michał Olejnik, July 2022

⭐️⭐️⭐️⭐️⭐️

As I started a book, I found it boring. Some early chapters demotivate me, but I decided to continue, and after some chapters, things changed, and I am amazed. There is a ton of knowledge. I found some chapters pretty difficult they need 100% attention. I had a plan to revise some chapters of this book again. Thank you, the authors, and the team for your time and effort.

—Hafiz Hussain, Jan 2022

On Amazon

⭐️⭐️⭐️⭐️⭐️ Do not fight the grain of the language!

As the authors describe in the book, every language has its own grain and so does Kotlin. Kotlin although promoted as a better Java is so much more. It has its own grain, its own idioms.

This is a book for all levels of developers that would like to try Kotlin and especially for people coming from Java. Make no mistake though! This book has, also, its own grain and its not simply a java to kotlin book. You will delve into TDD, functional programming and a plethora of refactoring techniques that you will be able to use day in day out.

Do not falter and buy this book as fast as possible!

—George, July 2022

⭐️⭐️⭐️⭐️⭐️ Effective Java for Kotlin

This book is not for those new to Kotlin but it is probably the best book for learning how to write Koltin. Much of what was best practice in Java no longer applies in Kotlin because it doesn’t have the heavy handed OOP restrictions on it that Java has and is more of a hybrid language allowing OOP, FP, and DOP to all merge.

—Jswizzy, December 2021

⭐️⭐️⭐️⭐️⭐️ Beyond expectations

When buying the book, I thought: “I’m already past that point where I need to be guided how to go from Java to Kotlin”. I was sure that it was about just migrating to Kotlin, forget Java, it’s crap and let’s be fanboys of Kotlin. However, after first pages I actually learned about the history of Java and where the differences between Java and Kotlin come from. I’ve been just 6 years in the industry, and started with Java 8, so such retrospective was very valuable. The great term introduced in the book - language’s grain - is the answer to most differences and was one of the “aha!” moments for me. This book is a great read for Java developers that even doesn’t really want to go into Kotlin (yet), so that they see that Kotlin offers what Java has been trying to be for several years now. It articulates the strengths and reasons first, then you go on a sort-of-pair-programming session with the authors (well, unidirectional, but always), and in a very informal way, play with the code and refactor it in different ways. The authors share the reasons of each refactoring steps and explain the trade-offs. All of this is with keeping compatibility with existing Java code base in mind, because the authors realize that it’s nearly impossible to do a big-bang refactoring to Kotlin.

Note: this is not a book which I would recommend as a first read about Kotlin. As the authors state themselves, they didn’t mean to teach the language, but rather build on top of the basic knowledge that someone should gather somewhere else. Once you have a nice grasp of the syntax and basics, you are good to go with this book.

—Piotr Krzemiński, December 2021

⭐️⭐️⭐️⭐️⭐️ Valuable

Kotlin is a really nice language but is not so common that you have the opportunity to start writing software from scratch, not professionally anyway. This book describes in a really good way how you transform your existing Java code base to Kotlin, step by step, concept by concept. It is pedagogical, mixing the rational behind what you want to accomplish (immutability for instance) and then it shows how to transform the Java example to Kotlin.

Highly recommended.

—Torbjörn, November 2021

⭐️⭐️⭐️⭐️⭐️ A great learning approach, insightful advice to adapting to Kotlin

As a Java developer who now using Kotlin as my core JVM language, I found my self constantly thinking the Java way and my verbose bloated Kotlin reflected this.

Following along with Nat and Duncan has been great, they have used a learning model based on the gradual refactoring and conversion of the test project using a bite size incremental git commit history, which has been great to review after every few paragraphs to internalise the point being illustrated.

The mutability pit falls of Java and the immutability opportunity in Kotlin is frequently presented in the book.

Highly recommended

—Andrew Farrell, October 2021

On O’Reilly

⭐️⭐️⭐️⭐️⭐️

This is a great piece for every Java programmer who thinks about trying out Kotlin. It doesn’t cover every language feature and is by no means a replacement for the reference documentation, but it is something more important in my opinion. As rarely (if ever) in the real world there is a chance to suddenly migrate your project from one language to another, it is crucial to know how you can do such a thing incrementally and where it may bring the most value for your buck. And this book pretty much gives you just that.

I also really liked that the authors put a lot of focus not only on the language itself but also generally on best practices of software development and functional programming especially. The examples are rather simple, but they convey the message pretty well. The text is easy to read and understandable. Overall, I can truly recommend this book.

—michal.olejnik, July 2022

⭐️⭐️⭐️⭐️⭐️

Extremely well written. Gives historical context as to why Kotlin is what it is and how that fixes issues that were accumulated in the Java througout the years. A great intro on how to start with Java to Kotlin conversion on your projects.

—josef.bodnar, October 2021

⭐️⭐️⭐️⭐️⭐️

I have been using Java for over 10 years, this book is a “breakthrough” for me, it not only helped me develop a “functional thing” when approaching a new problem, it also helped guiding me in migrating existing code (if we want to) in a safe and progressive manner through refactoring and tooling. It was a very enjoyable read, I have to admit that after 10 years of Java/OO/updating mutable state, to step into this next level, I need to (and I am willing to) completely “rewire” my brain to a more functional settings. I know where my currently gap is and what my future approach might look like, and I am convinced that the continued learning and practicing will lead to better (more concise, reasonable, composable, immutable) software. Great thanks to Duncan and Nat.

—rockyu, July 2021

⭐️⭐️⭐️⭐️⭐️

Even if you don’t write Java this book is invaluable. Much of it can be applied to Swift or even Javascript

—smithjn, May 2021