Kotlin In-Depth [Vol-I]: A Comprehensive Guide to Modern Multi-Paradigm Language
- Length: 338 pages
- Edition: 1
- Language: English
- Publisher: BPB Publications
- Publication Date: 2020-01-31
- ISBN-10: 9389328586
- ISBN-13: 9789389328585
- Sales Rank: #2278512 (See Top 100 Books)
Master the concise and expressive power of a pragmatic, multi-paradigm language for JVM, Android and beyond
Key Features
- Language fundamentals
- Object-oriented and functional programming with Kotlin
- Kotlin standard library
- Building domain-specific languages
- Using Kotlin for Web development
- Kotlin for Android platform
- Coroutine-based concurrency
Description
The purpose of this book is to guide a reader through the capabilities of Kotlin language and give examples of how to use it for the development of various applications, be it desktop, mobile or Web. Although our primary focus is on JVM and Android, the knowledge we’re sharing here, to various extents, applies to other Kotlin-supported platforms such as JavaScript, native and even multi-platform applications.The book starts with an introduction to the language and its ecosystem, which will give you an understanding of the key ideas behind the Kotlin design, introduce you to the Kotlin tooling and present you the basic language syntax and constructs. In the next chapters, we get to know the multi-paradigm nature of Kotlin which allows us to create powerful abstractions by combining various aspects of functional and object-oriented programming. We’ll talk about using common Kotlin APIs, such as the standard library, reflection, and coroutine-based concurrency as well as the means for creating your own flexible APIs based on domain-specific languages.
What will you learn
By the end of the book you’ll obtain a thorough knowledge of all the basic aspects of Kotlin programming. You’ll be able to create a flexible and reusable code by taking advantage of object-oriented and functional features, use Kotlin standard library, compose your own domain-specific languages, write asynchronous code using Kotlin coroutines library as well. You’ll also have a basic understanding of using Kotlin for writing test code, web applications and Android development. This knowledge will also give you a solid foundation for deeper learning of related development platforms, tools, and frameworks.
Who this book is for
The book is primarily aimed at developers who are familiar with Java and JVM and are willing to get a firm understanding of Kotlin while having little to no experience in that language. Discussion of various language features will be accompanied, if deemed necessary, by comparisons with their Java’s analogs, which should simplify the Java-to-Kotlin transition. Most of the material, however, is rather Java-agnostic and should be beneficial even without prior knowledge of Java. In general, experience in object-oriented or functional paradigm is a plus, but not required.
About the Author
Aleksei Sedunov has been working as a Java developer since 2008. Since joining JetBrains in 2012, he’s been actively participating in the Kotlin language development, focusing on IDE tooling for the IntelliJ platform. Currently, he’s working in a DataGrip team, a JetBrains Database IDE, while carrying on with Kotlin as a main development tool.
Cover Page Title Page Copyright Page Dedication About the Author Acknowledgement Preface Errata Table of Contents 1. Kotlin: Powerful and Pragmatic Structure Objective What is Kotlin? Safe Multiparadigm Concise and expressive Interoperable Multiplatform Kotlin Ecosystem Coroutines Testing Android Development Web Development Desktop applications Getting started with Kotlin Setting up an IntelliJ project Using REPL Kotlin Playground Setting up an Eclipse project Conclusion 2. Language Fundamentals Structure Objective Basic syntax Comments Defining a variable Identifiers Mutable variables Expressions and operators Basic types Integer types Floating-Point types Arithmetic operations Bitwise operations Char type Numeric conversions Boolean type and logical operations Comparison and equality Strings String templates Basic String operations Arrays Constructing an array Using arrays Conclusion 3. Defining Functions Structure Objective Functions The Anatomy of a Kotlin Function Positional versus named arguments Overloading and default values Varargs Function scope and visibility Packages and imports The packages and directory structure Using import directives Conditionals Making decisions with if statements Ranges, progressions, and in operation When statements and multiple choice Loops The while/do-while loop Iterables and for loop Changing loop control-flow: break and continue Nested loops and labels Tail-recursive functions Exception handling Throwing an exception Handling errors with try statements Conclusion Questions 4. Working with Classes and Objects Structure Objective Defining a class A class anatomy Constructors Member visibility Nested classes Local classes Nullability Nullable types Nullability and smart casts Not-null assertion operator Safe call operator Elvis operator Properties: beyond simple variables Top-level properties Late initialization Using custom accessors Lazy properties and delegates Objects Object declarations Companion objects Object expressions Conclusion Questions 5. Leveraging Advanced Functions and Functional Programming Structure Objective Functional programming in Kotlin Higher-order functions Functional types Lambdas and anonymous functions Callable references Inline functions and properties Non-local control flow Extensions Extension functions Extension properties Companion extensions Lambdas and functional types with receiver Callable references with receiver Scope functions run / with functions run without context apply / also functions Extensions as class members Conclusion Questions 6. Using Special-Case Classes Structure Objective Enum classes Exhaustive when expressions Declaring enums with custom members Using common members of enum classes Data classes Data classes and their operations Destructuring declarations Inline classes Defining an inline class Unsigned integers Conclusion Questions 7. Exploring Collections and I/O Structure Objective Collections Collection types Iterables Collections, Lists, and Sets Sequences Maps Comparables and Comparators Creating a Collection Basic operations Accessing collection elements Collective conditions Aggregation Filtering Transformation Extracting subcollections Ordering Files and I/O streams Stream utilities Creating streams URL utilities Accessing file content File system utilities Conclusion Questions 8. Understanding Class Hierarchies Structure Objective Inheritance Declaring a subclass Subclass initialization Type checking and casts Common methods Abstract classes and interfaces Abstract classes and members Interfaces Sealed classes Delegation Conclusion Questions 9. Generics Structure Objective Type parameters Generic declarations Bounds and constraints Type erasure and reification Variance Variance: distinguishing producers and consumers Variance at the declaration site Use-site variance with projections Star projections Type aliases Conclusion Questions
Donate to keep this site alive
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.