• Complain

Christopher Arriola - Reactive Programming on Android with RxJava

Here you can read online Christopher Arriola - Reactive Programming on Android with RxJava full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: leanpub.com, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Christopher Arriola Reactive Programming on Android with RxJava

Reactive Programming on Android with RxJava: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Reactive Programming on Android with RxJava" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Christopher Arriola: author's other books


Who wrote Reactive Programming on Android with RxJava? Find out the surname, the name of the author of the book and a list of all author's works by series.

Reactive Programming on Android with RxJava — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Reactive Programming on Android with RxJava" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Reactive Programming on Android with RxJava
Christopher Arriola and Angus Huang

This book is for sale at http://leanpub.com/reactiveandroid

This version was published on 2017-06-27

This is a Leanpub book Leanpub empowers authors and publishers with - photo 1

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2017 Christopher Arriola and Angus Huang

This book is dedicated to my wife, Bianca. You inspire me beyond measure.- Chris Arriola

Table of Contents
Guide
Introduction

Since its inception in 2012, RxJava has slowly gained in popularity for enabling reactive programming on Android. Today in 2017, it is now deemed as the go-to and leading reactive library. Many companies have adopted the reactive way of programming including Google with its release of Android Architecture Components, which has many reactive elements in its design.

In Reactive Programming on Android with RxJava, we seek to condense RxJava principles and provide a structured and simplified approach with a lot of code examples. This book seeks to serve as a foundation for experienced Android developers who are new to RxJava so that they can start integrating it into their apps.

The book is broken into two parts:

The 1st part of the book will go through the basics:

  • In , we will give the backstory of RxJava and discuss what reactive programming is.
  • In , we will examine the core components in RxJava.
  • In , we will dive deeper into operators and highlight a couple of important ones.
  • In , we will cover multithreading and concurrency.

The 2nd part of the book will go through advanced concepts:

  • In , we will put together all the lessons from the 1st part of the book and see how they apply to Android.
  • In , we will talk about backpressure to control the flow of data.
  • In , we will go over error handling and how it differs from Javas exception handling.
Feedback and Questions

For any feedback or questions, please reach out to us directly:

  • Christopher Arriola (Email: c.rriola@gmail.com, Twitter: @arriolachris)
  • Angus Huang (Email: angus.huang@alum.mit.edu)
Part 1: RxJava Basics
Chapter 1: What is Reactive Programming?

Reactive programming can most simply be defined as asynchronous programming with observable streams. Well, what does that mean? Lets break it down

Asynchronous programming, in the context of reactive programming, is a bit of a loaded term. In the traditional sense, it is programming in a non-blocking way such that long-running tasks are performed separately from the main application thread. In another sense, it is an event-driven style of programming where the events themselves are asynchronous and can arrive at any point in time.

Observable refers to an entity that can be subscribed to by any number of observers interested in its state. The observable entity will then push updates to its observers when there is a state change or event arrival. This is the classic Observer Pattern.

A stream (or data stream) can be thought of as an ordered sequence of events. These events may arrive at any point in time, may have no defined beginning or end, and are often generated by sources external to our application.

Re-assembling these terms, an observable stream is, then, a sequence of events that can be subscribed to and whose observers will be notified for each incoming event. And asynchronous programming with observable streams is a way to asynchronously handle data streams by using a push-based, observer pattern to keep the application responsive.

Can you think of some examples of data streams that we might want to handle using reactive programming? As an Android developer, you have no doubt dealt with many forms of data streams

  • User-Generated Events: Click events, swipe events, keyboard input, device rotations these are just a few examples of events initiated by the user. If we consider each of these events across a timeline, we can see how they would form an ordered sequence of eventsa dynamic and potentially infinite data stream.
  • I/O Operations: Network requests, file reads and writes, database accesses I/O operations are probably the most common type of data streams you will apply reactive principles to in practice. I/O operations are asynchronous since they take some significant and uncertain amount of time to complete. The responsewhether it be JSON, a byte array, or some plain-old Java objectscan then be treated as a data stream.
  • External System Events: Push notifications from the server, GCM broadcasts, updates from device sensors events generated from external producers are similar to user-generated events in their dynamic and potentially infinite nature.
  • Just About Anything: Really. Just about anything can be modeled as a data streamthats the reactive mantra. A single, scalar value or a list of objects static data or dynamic events any of these can be made into a data stream in the reactive world.

All of the previous examples are events that we want our program to take immediate action on. That is the point of reactive programmingto be reactive. With reactive programming, data is a first-class citizen. Your program will be driven by the flow of data as opposed to the thread of execution. And RxJava, the library we will be using, provides a thorough set of APIs for dealing with these data streams in a concise and elegant manner. But before we delve into the anatomy of RxJava, lets take a look at how it came to be.

The History of Reactive Programming

On October 28, 2005, Microsoft CTO, Ray Ozzie, wrote a 5000-word internal memo titled The Internet Services Disruption. The memo stressed to every department at Microsoft that they needed to adapt to the new Internet services era. With big players in the field like Google, Facebook, and Amazon, they needed to move fast.

Erik Meijer and the Cloud Programmability Team at Microsoft heeded that call. They were determined to alleviate the complexity that plagued these large systems and killed developer productivity. The team decided to work on a programming model that could be utilized for these data-intensive Internet services. The breakthrough occurred when they realized that by dualizing the Iterable interface from the Gang of Fours Iterator Pattern, they would have a nice push-based model for easily dealing with asynchronous data streams. Over the course of the next couple years, they would refine this idea and create Rx.NET (Reactive Extensions for .NET).

Rx.NET defined the set of interfaces (i.e. IObservable, IObserver) that would be fundamental to reactive programming. Along with these came a toolbox of APIs for manipulating data streams such as mapping, filtering, selecting, transforming, and combining. Data streams had achieved first-class status with Rx.NET.

The Birth of RxJava

One of the first users of this technology was Jafar Husain. When he left Microsoft and joined Netflix in 2011, he continued to evangelize Rx. Around that time, Netflix had successfully transitioned from a DVD rental service to an on-demand, streaming service. By 2012, business was boomingthey would reach nearly 30 million subscribers by the end of the year. During this upward trajectory, the Netflix team realized that their servers were having a hard time keeping up with the traffic.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Reactive Programming on Android with RxJava»

Look at similar books to Reactive Programming on Android with RxJava. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Reactive Programming on Android with RxJava»

Discussion, reviews of the book Reactive Programming on Android with RxJava and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.