Kotlin is a powerful and pragmatic language, but it's not enough to know about its features. We also need to know when they should be used and in what way. This book is a guide for Kotlin developers on how to become excellent Kotlin developers. It presents and explains in-depth the best practices for Kotlin development. Each item is presented as a clear rule of thumb, supported by detailed explanations and practical examples.
Marcin Moskała Knihy






Projektanci Kotlina postawili na pragmatyzm. Oznacza to, że do dziś wszystkie decyzje związane z rozwojem języka są podejmowane z uwzględnieniem potrzeb biznesowych: produktywności, skalowalności, prostej konserwacji, niezawodności i wydajności. Od początku szczególną uwagę zwraca się również na bezpieczeństwo, czytelność, wielokrotne używanie kodu, łatwość użycia narzędzi i możliwości współdziałania z innymi językami. Bardzo ważna okazała się też wydajność zarówno działania kodu, jak i pracy programisty. Konsekwentne przestrzeganie tych założeń dało znakomite efekty. Dziś Kotlin jest świetnym wyborem dla programisty - pod jednym warunkiem: że zna specyfikę języka i korzysta z niego we właściwy sposób. Ta książka jest przeznaczona dla doświadczonych programistów Kotlina, którzy chcą opanować ten język na wysokim poziomie. Wyjaśniono w niej sposoby korzystania ze szczególnych funkcji Kotlina, aby możliwe było uzyskanie bezpiecznego, czytelnego, skalowalnego i wydajnego kodu. Znalazły się w niej informacje o najlepszych praktykach pisania kodu w Kotlinie ze szczególnym uwzględnieniem praktyk wysokiego poziomu, zalecanych przez autorytety i twórców języka. Wyczerpująco omówiono też kwestie związane z właściwościami i typami specyficznymi dla platformy oraz tworzenie języków dziedzinowych, a także klasy i funkcje wewnątrzwierszowe. Jest to praktyczny przewodnik zawierający zbiór wytycznych, których uwzględnienie pozwoli pisać dobry i idiomatyczny kod w Kotlinie. W tej książce między innymi: reguły pisania kodu o wysokiej jakości programowanie dla różnych platform oraz aplikacje mobilne wzorce i konwencje programistyczne konwencje i kontrakty dla programistów wspólnie tworzących projekt zapewnianie wysokiej wydajności aplikacji i bibliotek Kotlin: wydajność, bezpieczeństwo, radość z programowania!
You know how to use Kotlin, but do you know the advanced features? What are the consequences of using variance modifiers? What limitations do they introduce, and how can these be overcome? How does property delegation work? How to use reflection? How to implement a KSP or an annotation processor? How is a Kotlin Compiler Plugin implemented? If you want to know the answers to these questions, this book is for you. This book focuses on the advanced aspects of Kotlin's development. These are often features and tools that developers use daily, even though they dont know exactly how they work. This book explains them and gives you the knowledge to use these features in your projects. WHO IS THIS BOOK FOR? This book is for developers with Kotlin experience who want to learn about its advanced features. Readers are expected to have experience in Kotlin development. All the required knowledge can be discovered in the books Kotlin Essentials and Functional Kotlin. WHAT IS COVERED? This book focuses on advanced Kotlin features, including: Generic variance modifiers Interface and property delegation Kotlin Contracts Kotlin and Java interoperability Multiplatform development Using Kotlin/JS Kotlin reflection Annotation Processor Kotlin Symbol Processor Kotlin Compiler Plugins Static Analysis with custom rules
Kotlin is a powerful language that has already revolutionized Android and backend development, but it also has powerful support for functional programming. Its amazing features, like functional collection processing, DSL builders, scope functions, or context receivers, help developers achieve intuitive and expressive functional syntax. Additionally, Kotlins extensibility allows libraries like Arrow to promote an even more functional style, all while keeping proper type safety, stability, and performance. Thanks to all this, Kotlin has become the promised land for many developers who are passionate about functional programming in real-life applications. This book is about Kotlins functional programming features. It covers the essentials first and then builds on them. It presents important and practical topics like collection processing, function references, scope functions, DSL usage and creation, and context receivers. WHO IS THIS BOOK FOR? This book is perfect for developers who know the basics of Kotlin and want to learn more advanced features. Math knowledge is NOT required to understand and benefit from this book. It is a natural continuation of Kotlin Essentials. WHAT IS COVERED? This book focuses on Kotlins functional features, including: Generic variance modifiers Covariant Nothing Object pattern Generic variance modifier limitations Interface delegation Implementing custom property delegate Property delegates from Kotlin stdlib Kotlin Contracts Kotlin and Java type mapping Annotations for Kotlin and Java interoperability Multiplatform development structure, concepts and possibilities Implementing multiplatform library Implementing Android and iOS applications with shared module Essentials of Kotlin/JS Reflecting Kotlin elements Reflecting Kotlin types Implementing custom Annotation Processor Implementing custom Kotlin Symbol Processor KSP incremental compilation and multiple round processing Defining Compiler Plugin Core Static Analysis concepts Overview of Kotlin static analyzers Defining custom Detekt rule This book is full of example projects, including: Type-safe task update class using Covariant Nothing Object pattern (Generic variance modifiers chapter) Logging property delegate (Property delegation chapter) Object serializer (Reflection chapter) Random value generator for generic types (Reflection chapter) Annotation Processor generating interface for a class (Annotation Processing chapter). Kolin Symbol Processor generating interface for a class (Kotlin Symbol Processing chapter). Detekt rule finding System.out.println usage.
Kotlin is a powerful and pragmatic language, but it's not enough to know about its features. We also need to know when they should be used and in what way. This book is a guide for Kotlin developers on how to become excellent Kotlin developers. It presents and explains in-depth the best practices for Kotlin development. Each item is presented as a clear rule of thumb, supported by detailed explanations and practical examples. Effective Kotlin provides insights into the idiomatic way of Kotlin development, as well as many general programming best practices and details about advanced Kotlin features like DSL creation, generics, platform types or inline functions and classes. All that for experienced Kotlin developers to get more effective when they use this programming language: to make safe, well designed and efficient code. The purpose of this book To really unleash the advantages of Kotlin, we need to use it properly. To do so, not only do we need to know about different Standard Library (stdlib) functions but even more, we need a good understanding of Kotlin features, purpose, and design. The main goal of this book is to explain how to use different Kotlin features to achieve safe, readable, scalable, and efficient code. Since this book is written to help developers get better at writing code, it also touches many general rules for programmers. This book tries to compose as much knowledge about best practices in Kotlin as possible. You can call it a collection of best practices. For whom the book is written This book is not teaching basics. It assumes that you have enough knowledge and skills to do Kotlin development. If you dont, I recommend starting first from resource designed for beginners. Effective Kotlin is directed to experienced Kotlin developers. Though I will assume that even experienced developers might not know some features. This is why I explain some concepts like: Property Platform type Named arguments Property delegation DSL creation Inline classes and functions Tail recursion I want this book to be a complete guide for Kotlin developers on how to become an amazing Kotlin developer.
Kotlin is a powerful language, largely thanks to its expressive syntax, intuitive and null-safe type system, and great tooling support. Its no wonder that Kotlin is the most popular language for Android development and is a popular replacement for Java on backend applications. It is also used for data science and for multiplatform, iOS, desktop, and web application development.
Kotlin Coroutines. Deep Dive 2nd ed
- 342 stránek
- 12 hodin čtení
Kotlin coroutines have revolutionized JVM development, especially on Android and the backend, as they let us easily implement efficient and reliable multithreading. Their cutting-edge design and features are ideally suited to modern use cases. In this book, we will explore how Kotlin coroutines work and how we can use them to improve our applications using both the built-in support and the kotlinx.coroutines library. This is a practical book. It shows everything with examples and focuses on real-life use cases. As this technology is already widely used on Android and backend applications, we will see how we can use it there and what the best practices are. WHO IS THIS BOOK FOR? This book is for Kotlin developers who want to understand Kotlin Coroutines and learn to use them in real-life projects in accordance with best practices. The book focuses on backend and Android use cases, but it also presents knowledge that can be used on other platforms. WHAT IS COVERED? The book is divided into the following parts: Part 1: Understanding Kotlin Coroutines - dedicated to explaining what Kotlin Coroutines are and how they really work. Part 2: Kotlin Coroutines library - explaining the most important concepts from the kotlinx.coroutines library and how to use them well. Part 3: Channel and Flow - focused on Channel and Flow from the kotlinx.coroutines library. This book is based on a workshop I conduct. During its iterations I have been able to observe what interested attendees and what did not. These are the elements that are most often mentioned by attendees, so I mainly focus on the following: How do coroutines really work? (Part 1) How to use coroutines in practice? (Part 2 and 3) What are the best practices? (Part 2 and 3) Testing Kotlin coroutines (Testing Kotlin Coroutines in Part 2) What is Flow and how does it work? (Part 3)