Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Kotlin Programming

You're reading from   Learn Kotlin Programming A comprehensive guide to OOP, functions, concurrency, and coroutines in Kotlin 1.3

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789802351
Length 514 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Stefan Bocutiu Stefan Bocutiu
Author Profile Icon Stefan Bocutiu
Stefan Bocutiu
Stephen Samuel Stephen Samuel
Author Profile Icon Stephen Samuel
Stephen Samuel
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Fundamental Concepts in Kotlin FREE CHAPTER
2. Getting Started with Kotlin 3. Kotlin Basics 4. Object-Oriented Programming in Kotlin 5. Section 2: Practical Concepts in Kotlin
6. Functions in Kotlin 7. Higher-Order Functions and Functional Programming 8. Properties 9. Null Safety, Reflection, and Annotations 10. Generics 11. Data Classes 12. Collections 13. Testing in Kotlin 14. Microservices with Kotlin 15. Section 3: Advanced Concepts in Kotlin
16. Concurrency 17. Coroutines 18. Application of Coroutines 19. Kotlin Serialization 20. Other Books You May Enjoy

What this book covers

Chapter 1, Getting Started with Kotlin, covers how to install Kotlin, the Jetbrains Intellij IDEA, and the Gradle build system. Once the setup of the tool chain is complete, the chapter shows how to write your first Kotlin program.

Chapter 2, Kotlin Basics, dives head first into the basics of Kotlin, including the basic types, basic syntax, and program control flow structures, such as if statements, for loops, and while loops. The chapter concludes with Kotlin-specific additions, such as when expressions and type inference.

Chapter 3, Object-Oriented Code in Kotlin, focuses on the object-oriented aspects of the language. It introduces classes, interfaces, objects and the relationship between them, as well as subtypes and polymorphism.

Chapter 4, Functions in Kotlin, shows that functions, also known as procedures or methods, are the basic building blocks of any language. This chapter covers the syntax for functions, including Kotlin enhancements such as named parameters, default parameters, and function literals.

Chapter 5, Higher-Order Functions and Functional Programming, focuses on the functional programming side of Kotlin, including closures, also known as lambdas, and function references. It also covers functional programming techniques, such as partial application, function composition, and error accumulation.

Chapter 6, Properties, explains that properties work hand in hand with object-orientated programming to expose values on a class or object. This chapter covers how properties work, how the user can best make use of them, and also how they are represented in the bytecode.

Chapter 7, Null Safety, Reflection, and Annotations, explains that null safety is one of the main features that Kotlin provides, and the first part of this chapter covers in depth the whys and how's of null safety in Kotlin. The second part of the chapter introduces reflection—runtime introspection of code—and how it can be used for meta programming with annotations.

Chapter 8, Generics, explains that generics, or parameterized types, are a key component of any advanced type system, and the type system in Kotlin is substantially more advanced than that available in Java. This chapter covers variance, the type system, including the nothing type, and algebraic data types.

Chapter 9, Data Classes, shows that immutability and boilerplate-free domain classes are a current hot topic, due to the way they facilitate more robust code and simplify concurrent programming. Kotlin has many features focused on this area, which it calls data classes.

Chapter 10, Collections, explains that collections are one of the most commonly used aspects of any standard library, and Java collections are no different. This chapter describes the enhancements that Kotlin has made to the JDK collections, including functional operations such as map, fold, and filter.

Chapter 11, Testing in Kotlin, explains that one of the gateways into any new language is using it as a language for writing test code. This chapter shows how the exciting test framework, KotlinTest, can be used to write expressive, human-readable tests, with much more power than the standard JUnit tests allow.

Chapter 12, Microservices in Kotlin, shows that microservices have come to dominate server-side architecture in recent years, and Kotlin is an excellent choice for writing such services. This chapter introduces the Lagom microservice framework and shows how it can be used to great effect with Kotlin.

Chapter 13, Concurrency, explains that, as multicore-aware programs are becoming more and more important in server-side platforms, this chapter is focused on a solid introduction to concurrent programming techniques that are vital in modern development, including threads, concurrency primitives, and futures.

Chapter 14, Coroutines, covers the powerful Kotlin concurrency library known as coroutines that enable thread-safe code to be written in a simple, imperative way. This chapter focuses on introducing the core constructs of coroutines, how they work, and perhaps, most importantly, why they are useful.

Chapter 15, Application of Coroutines, focuses on real-world scenarios and use cases of coroutines. This chapter expands on the previous chapter, covering use cases such as producers and consumers, channels, debugging in a multithreaded context, and how to bridge normal threaded code with the coroutine world.

Chapter 16, Kotlin Serialization, introduces a compiler plugin, written by Jetbrains, that generates serialization and deserialization functions for Kotlin classes that do not use runtime reflection for introspection. This results in more performant code. This chapter also includes information on several different serialization formats available for this library.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime