Shape Shape Group point Group chapter-list Shape Shape Copy 12 Shape Shape Copy 3 Shape Group Shape dropdown editor editor Combined Shape grid Shape Copy 4 Shape Copy 7 Shape language language Shape megaphone paperback Shape platform noun_419259-2 copy play-icon BS-Question-Rounded-Circle quotes noun_610406 stacked-books-1 stacked-books-2 Shape Copy 5 Combined Shape Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group
New

Kotlin Coroutines by Tutorials

$44.99 $54.99

Android is inherently asynchronous and event-driven, with strict requirements as to on which thread certain things can happen.

Learn how to use Kotlin coroutines to solve common Android programming problems using asynchronous programming techniques!

Note: This book is in Early Access. You’ll get advance access to the book while it’s in development, and you’ll get a free update to the complete digital edition of the book when it’s complete!

Estimated final release date: Spring 2019.

Developer Guide

Intermediate

For Intermediate Developers
D1cb7b21 1d24 4852 8b58 348888f589aa

The importance of concurrency is discovered quite early on by people who start with Android development. Android is inherently asynchronous and event-driven, with strict requirements as to on which thread certain things can happen.

Add to this the often-cumbersome Java callback interfaces, and you will be trapped in spaghetti code pretty quickly (aptly termed as “Callback Hell”). No matter how many coding patterns you use to avoid that, you will have to encounter the state change across multiple threads in one way or the other.

The only way to create a responsive app is by leaving the UI thread as free as possible, letting all the hard work be done asynchronously by background threads.

Kotlin Coroutines by Tutorials will teach you the techniques you need to solve common programming problems using asynchronous programming.

Table of Contents

1.

What is Asynchronous Programming?

Before getting you into the magic of coroutines, we’ll help you understand what problem coroutines will solve for you. You’ll learn what it means to be asynchronous and how to escape from an “indentation hell.” This is a fundamental chapter in order to understand the basics of multi-threading and concurrent programming.

2.

Setting Up Your Build Environments

This tutorial-style chapter will get your hands dirty as soon as possible — this is where you will set your environment and get ready to write your first coroutine.

3.

Getting Started with Coroutines

earn the core concepts of coroutines and how you can launch them using a builder. You’ll also learn about jobs and how to manage dependencies between them.

4.

Suspending Functions - Coming Soon

This is the main concept around coroutines. Here, you’ll learn how to define a suspending function and how to manage its results.

5.

Async/Await - Coming Soon

Synchronization is a fundamental part of every concurrent framework, and coroutines aren’t any different. In this chapter, you’ll learn how to master the async and away functions in order to achieve an efficient synchronization between tasks.

6.

Building Sequences & Iterators with Yield - Coming Soon

Functional programming is one of the coolest concept you can use in Kotlin and, in this chapter, you’ll see how you can use coroutines with sequences and iterators in order to manage theoretically infinite collections of data.

7.

Coroutine Contexts & Dispatchers - Coming Soon

Long and expensive tasks that run in the background and want to display the results on the main thread is a typical scenario in programming. In this chapter, you’ll understand how to achieve this through Context and Dispatchers.

8.

Exception Handling & Cancellation

Running a task is a relatively simple operation. Problems arise when errors occur or when you need to cancel the task because it becomes obsolete. In this chapter, you’ll learn how to do handle these scenarios and how coroutines can manage dependencies in these cases.

9.

Coroutines as State Machines - Coming Soon

Every time you use a framework, it’s important to understand how it works under the hood in order to fix unusual problems or to extend the way it works. In this chapter, you’ll learn what is a state machine and how it’s used by coroutines in order to do its magic.

10.

Channels - Coming Soon

Think about a box: Somebody can put objects into it and somebody else can remove them. Imagine, then, that the first actor, the producer, suspends its job if the box is full and that the second actor, the consumer, does the same if the box is empty. This is the logic behind channels, which you’ll learn about in this chapter.

11.

Producers & Actors - Coming Soon

This has nothing to do with Hollywood! Here, you’ll learn a different concurrent model that will allow you to manage the state of your application in a convenient and type-safe way.

12.

Broadcast Channels - Coming Soon

The channel you’ve covered in Chapter 10 is usually between a single sender and a single receiver. In this chapter, you’ll learn what is happening exactly and what you can do if you have multiple receivers.

13.

Coroutine Operators - Coming Soon

Learn the most important operators that you can use in order to elaborate and combine streams, as you usually do with Rx.

14.

Coroutines & RxKotlin Comparison - Coming Soon

Coroutines are not the silver bullet of concurrent programming. Here, you’ll learn what is the difference between coroutines and RxKotlin and how to understand which is the best for you.

15.

Coroutines on Android: Part 1

Learn how you can manage concurrency and multi-threading in Android and why coroutines can help you simplify and optimize code in many ways.

16.

Coroutines on Android: Part 2 - Coming Soon

Learn how to use different contexts in order to run long tasks in the background returning data to the main thread. You’ll learn how to use async callbacks for long-running tasks, such as a database or network access into sequential tasks, while also keeping track of and handling app lifecycles.

17.

Coroutines on Android: Part 3 - Coming Soon

Learn how to use Kotlin coroutines in an Android app with logging, exception handling, debugging and testing of code. Anko library will also be covered.

Meet the authors

4151992b 6204 4de5 b3c2 b2ea3b08c8e1

Kotlin Coroutines by Tutorials

Android is inherently asynchronous and event-driven, with strict requirements as to on which thread certain things can happen.

Learn how to use Kotlin coroutines to solve common Android programming problems using asynchronous programming techniques!

Note: This book is in Early Access. You’ll get advance access to the book while it’s in development, and you’ll get a free update to the complete digital edition of the book when it’s complete!

Estimated final release date: Spring 2019.

Top