Limit search to available items
Record 23 of 27
Previous Record Next Record
Book Cover
E-book
Author Castiblanco Torres, Miguel Angel, author

Title Learning concurrency in Kotlin : build highly efficient and robust applications / Miguel Angel Castiblanco Torres
Published Birmingham, UK : Packt Publishing, 2018

Copies

Description 1 online resource : illustrations
Contents Cover; Title Page; Copyright and Credits; Packt Upsell; Contributors; Table of Contents; Preface; Chapter 1: Hello, Concurrent World!; Processes, threads, and coroutines; Processes; Threads; Coroutines; Putting things together; Introduction to concurrency; Concurrency is not parallelism; CPU-bound and I/O-bound; CPU-bound; I/O-bound; Concurrency versus parallelism in CPU-bound algorithms; Single-core execution; Parallel execution; Concurrency versus parallelism in I/O-bound algorithms; Why concurrency is often feared; Race conditions; Atomicity violation; Deadlocks; Livelocks
Concurrency in KotlinNon-blocking; Being explicit; Readable; Leveraged; Flexible; Concepts and terminology; Suspending computations; Suspending functions; Suspending lambdas; Coroutine dispatcher; Coroutine builders; Summary; Chapter 2: Coroutines in Action; Downloading and installing Android Studio; Creating a Kotlin project; Adding support for coroutines; Android's UI thread; CalledFromWrongThreadException; NetworkOnMainThreadException; Requesting in the background, updating in the UI thread; Creating a thread; CoroutineDispatcher; Attaching a coroutine to a dispatcher
Starting a coroutine with asyncStarting a coroutine with launch; Using a specific dispatcher when starting the coroutine; Adding networking permissions; Creating a coroutine to call a service; Adding UI elements; What happens when the UI is blocked; Displaying the amount of news that were processed; Using a UI dispatcher; Platform-specific UI libraries; Adding the dependency; Using Android's UI coroutine dispatcher; Creating an asynchronous function to hold the request ... or not; A synchronous function wrapped in an asynchronous caller; An asynchronous function with a predefined dispatcher
An asynchronous function with a flexible dispatcherHow to decide which option is better; Summary; Chapter 3: Life Cycle and Error Handling; Job and Deferred; Job; Exception handling; Life cycle; New; Active; Canceling; Cancelled; Completed; Determining the current state of a Job; Deferred; Exception handling; States move in one direction only; A note on final states; RSS- Reading from multiple feeds concurrently; Supporting a list of feeds; Creating a thread pool; Fetching the data concurrently; Merging the responses; Testing the concurrent requests; Non-happy path- Unexpected crash
Having deferred store the exceptionDon't ignore the exception!; Summary; Chapter 4: Suspending Functions and the Coroutine Context; Improving the UI of the RSS Reader; Giving each feed a name; Fetching more information about the articles from the feed; Adding a scrollable list for the articles; Layout for the individual articles; Adapter to map the information; Adding a ViewHolder; Mapping the data; onCreateViewHolder; onBindViewHolder; getItemCount; Allowing the incremental addition of articles to the adapter; Connecting the adapter to the activity; Testing the new UI; Sanitizing the data
Summary The requirements of modern day applications are scalability, speed and making the most use of hardware. Kotlin provides immense support for concurrency. This book addresses the challenges for the design and implementation of concurrent code and shows you how to write lock-free concurrent code taking advantage of Kotlin's concurrency support
Notes Online resource; title from title page (Safari, viewed August 27, 2018)
Subject Application software -- Development.
Electronic data processing.
Functional programming (Computer science)
Mobile apps.
Object-oriented programming (OOP).
Parallel processing.
Programming & scripting languages: general.
Computers -- Programming -- Object Oriented.
Computers -- Programming -- Parallel.
Computers -- Programming Languages -- Java.
Application software -- Development
Electronic data processing
Functional programming (Computer science)
Mobile apps
Form Electronic book
ISBN 9781788626729
1788626729