RxJava 2.x in Action cover

RxJava 2.x in Action

No rating yet
Word count
497K words
Chapters
20
ISBN
9787121337222

Tags

Summary

RxJava 2.x in Action is one of the earlier Chinese technical books to systematically explain RxJava 2.x, published by Broadview. The book begins with the basic ideas of functional reactive programming, first introducing core types such as Observable, Flowable, Single, Completable, and Maybe, along with the usage and suitable scenarios of Subject and Processor. It then goes through the most important operator families in RxJava 2.x one by one: creation, transformation, filtering, conditional, boolean, combination, and connecting, using examples to explain the behavioral differences among them. After covering the fundamentals, the book devotes special discussion to the types of schedulers and the threading model in RxJava, as well as how to test Scheduler. It also has a separate chapter on the distinctive Backpressure mechanism and strategies in RxJava 2.x. The engineering practice section takes up a large portion: using Disposable, RxLifecycle, and AutoDispose to handle subscription lifecycles, using Transformer to encapsulate reusable logic, and using ParallelFlowable for parallel programming; it then moves in turn to the combined use of RxBinding, RxPermissions, RxAndroid, and Retrofit on the Android side, and guides readers to develop an Event Bus from scratch. On the backend side, through cases such as using RxJava to wrap HttpClient 4.5 and building a proxy IP pool based on Spring Boot, it demonstrates how reactive thinking is applied on the server side. The closing section introduces Java 8's Lambda, Stream, currying, and CompletableFuture, as well as ways to combine Kotlin with RxJava, and looks ahead to Java 9 and the Reactive Streams ecosystem. The book has 18 chapters and many examples, positioned as a practical reader that takes you from beginner to able to use it in projects.

Editor's review

学 RxJava 最容易卡在两点:一是操作符太多,记不住也分不清;二是不知道在真实项目里怎么用、什么时候该用。这本书的结构正好对着这两个痛点来:先把 Observable/Flowable/Subject 这些概念讲清楚,再用一章一族的节奏把创建、变换、过滤、条件、合并、连接操作符逐个过一遍,每个操作符都配示例,看完能建立一张清晰的地图。 后半本是它的价值所在。背压、Disposable 与生命周期管理、Transformer 复用、ParallelFlowable 并行,这些是真正上手写业务时绕不开的东西;作者又用 RxBinding、RxAndroid + Retrofit、手写 Event Bus、封装 HttpClient、Spring Boot 代理 IP 池等案例把它们串起来,Android 和后端两条线都照顾到了。最后谈 Java 8 函数式编程与 Kotlin,帮助你把 Rx 放回语言演进的大背景里理解。 书中的代码示例量不小,适合边读边敲。写作口吻偏通俗,不炫技,对当时中文资料稀缺的 RxJava 2.x 来说,是一本难得的体系化入门与实战过渡之作。需要注意书中技术栈(RxJava 2.x、Retrofit、RxAndroid 2.x)已是 2018 年前后的版本,阅读时应结合官方文档核对 API 现状。

Who it's for

A good fit for

  • 已经会写 Java 或 Kotlin、想系统入门响应式编程的开发者
  • 正在做 Android 开发,希望用 RxJava 改善异步与事件处理的工程师
  • Java 后端开发者,想了解 RxJava 在服务端与 Spring Boot 中的用法
  • 对函数式编程感兴趣、希望从实践角度切入的 IT 从业者

Not a good fit for

  • 完全没有 Java 基础、第一次学习编程的读者
  • 只想查阅 RxJava 最新版 API 文档、不需要系统讲解的人
  • 期待深入剖析 RxJava 源码实现细节的进阶读者

Reading tips

  1. 第1—4章务必按顺序读,概念和线程模型是后续所有操作符的基础。
  2. 第5—7章的操作符建议边读边写示例运行,重点记住彼此的差异而非全部细节。
  3. 第11—15章的实战案例可挑与自己方向相关的一两条动手复现,不必全做。
  4. 书中代码基于 RxJava 2.x,实践时对照官方文档确认 API 是否有变更或弃用。

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

Contents

  1. Chapter 1 Introduction to RxJava
  2. Chapter 2 RxJava Basics (Observable, Hot/Cold Observable, Flowable, Single/Completable/Maybe, Subject and Processor)
  3. Chapter 3 Creation Operators (create, just, from, repeat, defer, interval, timer)
  4. Chapter 4 Thread Operations in RxJava (Types of Schedulers, Threading Model, Testing Scheduler)
  5. Chapter 5 Transformation and Filtering Operators (map, flatMap, groupBy, buffer, window, first/last, take/skip, distinct/filter, debounce)
  6. Chapter 6 Conditional and Boolean Operators (all, contains, amb, defaultIfEmpty, sequenceEqual, skipUntil/skipWhile, takeUntil/takeWhile)
  7. Chapter 7 Combination and Connecting Operators (merge, zip, combineLatest, join, startWith, connect, push, refCount, replay)
  8. Chapter 8 Backpressure in RxJava
  9. Chapter 9 Using Disposable and Transformer (RxLifecycle, AutoDispose)
  10. Chapter 10 Parallel Programming in RxJava (ParallelFlowable)
  11. Chapter 11 Using RxBinding (with RxPermissions)
  12. Chapter 12 Using RxAndroid 2.x and Retrofit
  13. Chapter 13 Developing an Event Bus
  14. Chapter 14 Wrapping HttpClient 4.5 with RxJava
  15. Chapter 15 Spring Boot and RxJava 2
  16. Chapter 16 Functional Programming in Java 8 (Lambda, Stream, Currying, CompletableFuture)
  17. Chapter 17 Kotlin and RxJava
  18. Chapter 18 Looking to the Future
  19. Appendix A Common RxJava Operator List
  20. Appendix B Common Libraries in RxJava

FAQ

这本书讲的是 RxJava 1 还是 RxJava 2?
全书以 RxJava 2.x 为主线,Observable、Flowable、Single、Completable、Maybe 等类型以及背压机制都是 RxJava 2 的体系,与 RxJava 1.x 的 API 差异较大,阅读时不要混用旧版资料。
没有响应式编程基础能直接读吗?
可以。第1章就从函数响应式编程的概念讲起,并给出 RxJava 2 的 Hello World;只要具备 Java 语法基础和基本的多线程概念,就能跟上节奏。
书中的实战案例偏向 Android 还是后端?
两者都有。Android 方向包括 RxBinding、RxPermissions、RxAndroid 与 Retrofit 的组合、手写 Event Bus;后端方向包括用 RxJava 封装 HttpClient 4.5 和基于 Spring Boot 的代理 IP 池,读者可按需选读。
这本书现在读会不会过时?
书中核心技术思想(操作符语义、线程模型、背压、生命周期管理)依然适用,但 RxJava 2.x、Retrofit、RxAndroid 的具体 API 版本较老,且 Android 官方已主推协程,建议把它当作概念与思路的教材,配合最新官方文档实践。
每章都有练习题或项目吗?
书中没有专门的习题册式设计,但大量操作符与应用场景都配有可运行的示例代码,第13—15章是完整的小型项目式案例,可以当作练习动手复现。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

沈哲 Author

Shen Zhe is an author about whom limited public information is available; all that is currently known is a single management work, Multi-attribute Decision-making Methods Considering Decision Makers' Risk Preferences and Visions. The title indicates a focus on multi-attribute decision making, a core topic in management science and operations research, into whose traditional framework the author introduces two subjective dimensions—decision makers' risk preferences and visions—in an attempt to bring decision models closer to real management situations. Such a topic is typically aimed at researchers, graduate students and management practitioners, with an emphasis on methodological rigor and practicality. Because biographical and academic background information is lacking, the author's writing style and influence cannot yet be fully assessed; the choice of subject nonetheless shows a concern with the human factor in decision analysis and an interest in combining theoretical tools with practical judgment.

More by the same author

Top rated in the same category