Kotlin is evolving rapidly as a universal language—a single language with which one can do many things and do it elegantly! It can be used to create a wide range of applications, spanning from large server applications that can take advantage of the most modern advances in parallel processing and rich internet applications (RIA) that run in the ecosystem of a web browser to Android apps and tiny applications that run within tiny IoT processors.
In May 2017, when Google announced official support to Kotlin to develop Android applications, the status of Kotlin was elevated overnight from a nice, cool language to a language that needs to be taken seriously. Shortly thereafter, the Spring framework, which is mighty on the server-side development, added Kotlin only features. The Kotlin-favoring trend seems to have continued since then.
The vast array of applications that Kotlin can be used in and the value-add that Kotlin does in each of the cases with Kotlin-specific flavors can be quite overwhelming. This book is written to help the programmers find these in one place so as to put their hands around the diverse use case scenarios.
Nowadays, the Android application development process is quite extensive. Over the last few years, we have seen how various tools have evolved to make our lives easier. However, one core element of Android application development process hasn’t changed much over time, Java. The Android platform adapts to newer versions of Java, but to be able to use them, we need to wait for a very long time until new Android devices reach proper market propagation. Also, developing applications in Java comes with its own set of challenges since Java is an old language with many design issues that can’t be simply resolved due to backward compatibility constraints.
As the language was approaching release, we realized that it would be valuable to have a book about Kotlin, written by people who were involved in making design decisions for the language and who could confidently explain why things in Kotlin are the way they are. This book is a result of that effort, and we hope it will help you learn and understand the Kotlin language. Good luck, and may you always develop with pleasure!
The programs explained in this book, despite their strong affinity to the Kotlin way of thinking, will not be totally mysterious to Java developers or developers of other modern computer languages. One of the design goals of Kotlin is expressiveness, so understanding Kotlin programs requires little effort, even when the programs get shorter. But at some point, you have to pay for maximum brevity with a loss of expressiveness and a loss of readability. When it comes to deciding what is better, I favor expressiveness over brevity, but be assured that a loquacious programming style is a no-go. In the end, professional developers want to write concise apps because less code means lower costs when it comes to maintenance.
The book begins by showing you the practical aspects of smarter coding in Kotlin, explaining the basic Kotlin syntax and the impact of design patterns. Furthermore, the book provides an in-depth explanation of the classic design patterns, such as Creational, Structural, and Behavioral, before heading into functional programming. It then takes you through Reactive and Concurrent patterns, teaching you about Streams, Threads, and Coroutines to write better code. Toward the end, you will learn about the latest trends in architecture, exploring the design patterns for microservices, and discuss the considerations when choosing between different architectures, such as microservices and MVC.
While there are books and plenty of online material covering the language basics, and then there are those covering single niche areas, there was nothing that could be referred to for understanding the vast spectrum of usage scenarios. This book tries to fill the void. This is a single book that can be used as a reference to these various scenarios.
This is not a theory book. It is a practical guide to creating industry-grade applications with Kotlin. Each chapter takes one moderately sized requirement in a given area and shows how to create a Kotlin application to fulfill it. It contains a complete set of instructions that a programmer can follow and learn the applications by coding them first hand. It also highlights the special uses of Kotlin features as they are applicable to the problem at hand.
Kotlin is typically associated with Android development, and most discussion about it revolves gravitates around that. But the language has much more to offer and is ideal for modern server side developers. While any Android developer will find useful snippets in this book, the book is targeting Java and Scala developers primarily. The book will start with a introduction to Kotlin and explain how you set up your environment before moving on to the basic concepts. Once the basics are out of the way, the focus will shift towards more advanced concepts, and don’t be surprised if you see a few bytecode listings. Once you have completed the book you should have all the knowledge required to start using Kotlin for your next project.
Android is the most popular platform for mobile devices. Every year, there are more and more developers getting involved in Android development. The Android Framework makes it possible to develop applications for mobile phones, tablets, televisions, and much more! So far, all development has been done in Java. Recently, Google announced Kotlin as the second language developers can use. Because of this, and with Kotlin’s ever-growing popularity, we decided to introduce you to Android using Kotlin as its primary development programming language.
The book starts by analyzing different performance metrics and debugging tools that help us to identify performance bottlenecks. It’s important to understand how Kotlin and its modern features work under the hood; that’s why we will inspect a lot of bytecode in the book. We will learn how to benchmark our code and avoid different types of resource leaks. The book ends with best practices that will help you to sum up all things that you’ve learned.
Since its announcement as an officially supported language for Android, Kotlin has experienced a huge rise in popularity. This proliferation in popularity is in many ways warranted as Kotlin is a modern and extremely well-designed language, which has many domains of application—web, mobile, and native to name a few. As a direct consequence of its rise in popularity, Kotlin has experienced steady growth over the years.
When I started working as an Android developer, these questions continued to plague me, but got some friends as well. Why do we need so many loops in an application? Isn’t there anything to replace the iterators? Also, for Android applications, we must keep a lot of things in mind, as the processors and RAM in a mobile device are not as powerful as those in your PC. There is often an Out of Memory Exception if you do not structure your projects well. So, if we could have less iterators in our program, the UX will significantly improve, but, how do we do it? How do we replace iterators, and with what?
With Google’s announcement at the I/O Conference in 2017 to make Kotlin an official language for Android, Kotlin has been gaining popularity among developers around the world.
However, Kotlin’s use and popularity aren’t limited to the Android community. Many other communities, such as the desktop, web, and backend community are embracing Kotlin too. Many new libraries and frameworks are being created and existing ones are providing support for Kotlin.
Kotlin Cookbook will be a go-to guide to problems new Kotlin developers get stuck with. Along with that, Kotlin Cookbook will also help developers learn handy tricks and concepts that they may need while coding. This book will also help developers uncover the full potential of an amazing programming language, that is, Kotlin.
This book aims to enable developers who would like to explore the power of Android and experience and enjoy the journey of building Android applications. The chapters have been organized to enable fresh developers to understand and start from the basics, or if you are an experienced developer, to get ahead and explore the power of Kotlin.
From its first release, Kotlin has impressed programmers with its friendly syntax, conciseness, flexibility and power. In this book, we’ll teach you how to build your own Kotlin applications, and we’ll start by getting you to build a basic application and run it. Along the way, you’ll be introduced to some of Kotlin’s basic syntax, such as statements, loops and conditional branching. Your journey has just begun…
This book is designed to develop both server and client for an application. We have used the Kotlin language for both the server and client sides. In this book, Spring will be the server-side application, and Android the client-side application. Our primary focus is on those areas that will be able to help a developer develop a secure application with the latest architecture. This book describes the basics of Kotlin and Spring, which will be of benefit if you are unfamiliar with these platforms. We also designed the chapters for implementing security and database in a project. This book delves into the use of Retrofit for handling HTTP requests and SQLite Room for storing data in an Android device. You will also be able to find a way of how to develop a robust, reactive project. Then, you will learn how to test a project using JUnit and Espresso for developing a less bug-prone and stable project.