Java to Kotlin: A Refactoring Guidebook 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
From the Publisher
From the Preface
Hello, this is Duncan and Nat. As you’re reading this preface, you’re probably trying to decide whether to invest some hours into reading the rest of this book. So let’s cut to the chase:
This book won’t teach you to program computers in Kotlin.
We started writing a book that would, but it soon became clear that Kotlin is a large language, and so the book was going to take longer to write than we wanted. There are also already some great books in that space, and we don’t like competing against great.
We decided instead to make our lives easier by concentrating on teaching Kotlin to Java developers, based on a workshop that we run called Refactoring to Kotlin. This teaches the Kotlin language by converting existing code and is (according to our marketing material) designed for Java teams wanting to leverage their existing knowledge to accelerate their Kotlin adoption.
We started writing that book, but it soon became clear that Kotlin is still a large language, and so we would still be writing for a long time. We also found that motivated and experienced Java developers can pick up most of Kotlin very quickly.
It felt patronizing to plow our way through language features that our target readers will probably just appreciate and adopt as soon as they see them. So we abandoned that idea, and as a result:
This book won’t teach you the Kotlin language.
So why should you read it? Because we have written the book we wish was available when we first adopted Kotlin. We are experienced programmers who know Java and the Java ecosystem well. We hope you are too. Like us, you probably have experience in a number of other languages. You’ve learned the basics of Kotlin, and you recognize that to get the best out of the language you will need to design your systems differently. You have found that some things that are cumbersome in Java are much easier in Kotlin, and that some features, such as checked exceptions, are not there at all. You don’t want to end up merely writing Java code in Kotlin syntax.
Perhaps you have skin in the game. Maybe you’re in a technical leadership position, or have successfully convinced your team to adopt Kotlin. You might have spent some political capital to get Kotlin into the project. Now you need to ensure that the transition goes smoothly.
You may be responsible for a Java codebase and want to ensure that introducing Kotlin won’t destabilize its existing, business-critical code. Or you may be starting a Kotlin project from scratch but realize your design instincts turn more readily to Java and objects than to Kotlin and functions.
If this is you, as it was us, then you’ve come to the right place. This book will help you adapt your thinking and designs to take advantage of Kotlin. That’s not enough, though, because you have existing code that you need to maintain and enhance. So we also show how to migrate that code from Java to Kotlin syntax, and from Java to Kotlin thinking, incrementally and safely, using the automated refactoring tools built into the IntelliJ IDE.
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
At the heart of our business is a unique network of expert pioneers and practitioners who share their knowledge through the O’Reilly learning platform and our books—which have been heralded for decades as the definitive way to learn the technologies that are shaping the future. So individuals, teams, and organizations learn the tools, best practices, and emerging trends that will transform their industries.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
About the Author
Nat and Duncan both started programming in Java before its 1.0 release, and have 55 years of combined experience on both the JVM and other platforms. Until they discovered Kotlin in 2015 Java was their language of choice for most applications.
That changed when they fell in love with JetBrains’ new creation and spread the word, first with their own colleagues and clients, then the JVM community in London, and then internationally through conferences. They have both presented at KotlinConf, where they also run a one day workshop “Refactoring to Kotlin,” which forms the basis for the introductory chapters of this book.
- Publisher : O'Reilly Media; 1st edition (September 7, 2021)
- Language : English
- Paperback : 424 pages
- ISBN-10 : 1492082279
- ISBN-13 : 978-1492082279
- Item Weight : 1.48 pounds
- Dimensions : 7.25 x 1 x 9.5 inches
- Best Sellers Rank: #146,472 in Books (See Top 100 in Books)
- Customer Reviews:
About the authors
Top reviews from other countries
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.