Reactive Programming with RxJava,介绍一本书和Rx

Reactive Programming with RxJava Reactive Programming with RxJava, 2016. 立即下载

Reactive Programming with RxJava,介绍一本书和Rx

标签(空格分隔): book RxJava


Who Should Read This Book

Reactive Programming with RxJava targets intermediate and advanced Java program-
mers. You should be fairly comfortable with Java; however, prior knowledge of reac-
tive programming is not required. Many concepts in this book relate to functional
programming, but you do not need to be familiar with it either. There are two distinct
groups of programmers that can benefit from this book;

RxJava的响应式编程适用于中高级Java工程师。你应该熟悉Java语言,但却不必要熟悉响应式编程。
这本书中的很多概念涉及到了函数式编程,但是你同样不必要去掌握它。有两种程序员能够从中受益:

  • Craftsmen who seek improved performance on the server or more maintainable code on mobile devices. If you fal into this categroy, you will find ideas and solutions to real problems, you will find ideas and solutions to real problems as well as practical advice. In this case, RxJava is just another tool that this book will help to master.
  • Curious developers who’ve heard about reactive programming or RxJava in particular and want to get a fair understanding of it. If this is you, and if you are not planning to take advantage of RxJava in production code, you will significantly broaden your horizons.

  • 目标是在服务器和移动设备上提高性能或者更好的程序扩展性的工程师,如果你属于这类人,在本书中你能发现解决问题的办法以及实用的建议。本书讲帮你掌握这一工具。

  • 对流行起来的响应式编程或RxJava感兴趣并且希望有一个清晰的认识的人,如果你属于这类人,并且不准备将RxJava的优点应用在产品代码中。你可以显著的拓宽视野。

Additionally, if you are a hands-on software architect, this book will likely help you.
RxJava influences the overall architecture of entire systems, so it is worth knowing.
But even if you are just beginning your adventure with programming, try to go through the
first few chapters, which explain the basics. Underlying concepts like transformations and
composition are quite unversal and not related to reactive programming.

除此之外,如果你是一个软件架构师,这本书可能会帮助到你。RxJava以及影响到了整个软件架构,这是值得学习的。但是如果你刚刚开始编程的道路,尝试阅读基础的前几章。基本的概念比如转换和组合是通用的概念和响应式编程没有关系。

The book was struvtured such that you will derive the most from it by reading it from cover
to cover. If you can not afford that much time, however, fell free to cherry pick only the parts that are most insteresting. If there s a concept that was introduced earlier, you will most likely find a back reference to it. Following is an overview of each chapter:

这本书是循序渐进的,顺序阅读你可以掌握大部分。如果你没有充足的时间,也可以自由的选择感兴趣的部分。如果存在前文的概念,你可以到前文寻找。下面是章节概览。

  • Chapter 1 very briefly goes through the inception of RxJava, basic concepts, and ideas(Ben).
  • Chapter 2 explains how RxJava can appear in your application and how to interact with it. This chapter is very basic, but, but understanding concepts like hot versus cold sources is tremendously important(Tomasz).
  • Chapter 3 is a whirlwind tour of many operators provided by RxJava. We will introduce you to the expressive and powerful functions that are a foundation of this library(Tomasz).
  • Chapter 4 is more practical, showing how to embed RxJava in various places across your codebase. It also touches on concurrency(Tomasz).
  • Chapter 5 is advanced, explaining how to implement reactive applications from top to bottom.
  • Chapter 6 explains an important problem of flow control and backpressure mechainisms in RxJava that support it (Tomasz).
  • Chapter 7 shows techniques of unit testing, maintaining, and troubleshooting Rx-base applications(Tomasz).
  • Chapter 8 shows a few selected applications of RxJava, especially in distributed systems(Tomasz).
  • Chapter 9 highlights future plans for RxJava 2.x(ben).

  • 第一章简要介绍了RxJava的起步,基本概念,和想法。

  • 第二章阐述了如何将RxJava集成并运用在项目中,本章非常基础,同样理解如 动态编程和静态编程是风场重要的。
  • 第三章浏览了RxJava的很多操作符。我们会展示给你基于RxJava基础库强力有效的功能。
  • 第四章偏向与实战,展示了如何将RxJava的代码应用到你的代码中。RxJava同样样涉及并发。
  • 第五章是高级,阐述了如何将响应式程序应用到各个层面。
  • 第六章阐述了重要的流处理问题和RxJava支持的反压机制。
  • 第七章演示了RxJava程序如何进行单元测试,扩展和调试技术。
  • 第八章展示了使用RxJava的项目,特别是在分布式操作系统。
  • 第九章标注了第二版RxJava的功能概览。

CHAPTER 1 Reactive Programming with RxJava

RxJava is a specific implementation of reactive programming for Java and Android that is influenced by functional programming. It favors function composition, avoidance of global state and side effects, and thinking in streams to compose asynchronous and event-base programs. It begins with the observer pattern of producer/consumer callbacks and extends it with dozens of operators that allow composing, transforming, scheduling, throttling, error handling, and lifecycle management.

RxJava is a mature open source library that has found broad adoption both on the server and on Android mobile devices. Alone with the library, an active community of developers has built up around RxJava and reactive programming to contribute to the project, speak, write, and help one another.

This chapter will provide an overview of RxJava-what it is and how it works-and the rest of this book wull take you through all the details of how to use and apply it in your applications You can begin reading this book with no piror experience with reactive programming, but we will start at the beginning and take you through the concepts and practices of RxJava so that you can apply its strengths to your use cases.

RxJava被函数式编程的影响,是响应式编程针对Java和Android的一种具体实现。支持函数式编程,规避了全局变量和负面影响,并且以流的形式去编写异步的,事件型驱动编程模式。RxJava以生产者/消费者回调的观察者模式开始,并扩展了数十个允许编写,转换,调度,限制,错误处理和生命周期管理的运算符。

RxJava是一个成熟的开源库,已经在服务器和Android设备得到了广泛的应用,围绕RxJava,响应式编程 一个活跃的开发者社区已经被建立起来,提供项目,交流,写作和互相帮助。

本章提供了RxJava的概览-是什么,如何工作,其余部分介绍了如何应用到项目的详细介绍。你可以在没有响应式编程的经验,我们从头开始会为你讲解RxJava的概念和实例以便可以将其优势应用在你的项目当中。

Reactive Programming and RxJava

Reactive programming is a general programming term that is focused on reacting to changes, such as data values or events. It can and often is done imperatively. A callback is an approach to reactive programming done imperatively. A spreadsheet is great example of reactive programming: cells dependent on other cells automatically “react” when those other cells change.

响应式编程是一种面向变化传播编程范式,例如数据值或者事件。经常以命令式的完成,通过回调完成响应式编程。电子表格就是非常好的响应式编程的例子:表格根据其他表格的变化而’变化’。

On today’s computers everything ends up being imperative at some point as it hits the operating system and hardware. The computer must be told explicitly whtat needs to be done and how to do it. Hunmans do not think like CPUs and related systems, so we add abstractions. Reactive-functional programming is an abstraction, just like our higher-level imperative programming idioms are abstractions for the underlying binary and assembly instructions. The fact that everything ends up imperative is important to remember and understand because it helps us with the mental model of what reactive-functional programming is addressing and how it ultimately executes-there is no magic.

现代的计算机在某一时刻会将运行在操作系统和硬件上的所有的东西命令化。计算机必须被确切的告知么,如何去做。人类的思维不同于CPUs和操作系统,因此我们增加抽象。响应式编程是一种抽象,类似于我们更高层次的命令式编程是底层二进制和汇编语言的抽象。事实上,所有最终都是指令,记住和理解是非常重要的,他可以帮助你建立响应式编程范式是如何寻址和最终的指令没有魔法。

Reactive-functional programming therefore is an approach to programming-an abstraction on top of imperative systems-that allows us to program asynchronous and event-driven use cases without having to think like the computer itself and imperatively define the complex interactions of state, particularly across thread and network boundaries. Not having to think like the computer is a useful trait when it comes to asynchrony and event-driven systems, because concurrency and parallelism are involved, and these are very challenging characteristics to use correctly and efficiently. Within the Java community, the boooks Java Concurrency in Practive by Brian Goetz and Concurrent Programming in Java by Doug Lea(Addison-Wesley), and forums, and communities since I started using RxJava has convinced me even more than before of how difficult it really is to write high-performance, efficient, scalable, and correct concurrent software. And we haven’t been brought in distributed systems, which take concurrency and parallelism to another level.

响应式函数式编程是一种在命令式编程系统之上的抽象,他允许我们异步和事件驱动编程,而不必考虑计算机本身和命令式编程在状态交互,特别是跨线程和网络编程。因为并发和并行涉及到异步和事件驱动系统,所以不必像电脑一样去思考如何实现,正确有效的使用非常具有挑战性。自从我开始使用Rxjava,比以前更加相信在Java论坛,书籍《Java并发性》和《Java并发编程》和一些论坛,社区中,编写高性能,可扩展和正确的并发软件真的是很困难。我们还没有进入分布式系统,它将并发和并行提升到另一个层次上。

So, the short answer to what reactive-functional programming is solving is concurrency and parallelism. More colloquially, it is solving callback hell, which results from addressing reactive and asyncronous use cases in an imperative way. Reactive programming such as that implemented by RxJava is influenced by functional programming and uses a declarative approach to avoiding the typical pitfalls of reactive-imperative code.

所以,简要的说,响应式函数式编程就是解决了并发和并行。更通俗的说,它解决了结果返回通过寻址和命令式的异步编程的回调地狱。响应式编程范式比如RxJava,被函数式编程影响,使用声明式编程避免典型的响应式编程的陷阱。

When You Need Reactive Programming

Reactive programming is useful in scenarios such as the following:

  • Processing use events such as mouse movement and clicks, keyboard typing, GPS signals changing over time as users move with their device, device gyroscope signals, touch events, and so on.
  • Responding to and processing any and all latency-bound IO events from disk or network, given that IO is inherently asynchronous(a request is made, time passes, a response might or might not be received, which the tiggers further work.
  • Handling events or data pushed at an application by a producer it cannot control(system events from a server, the aforementioned user events, signals from hardware, events triggered by the analog world from sensors, and so on).

响应式编程在下面的情景是适用的:

  • 处理用户事件,比如鼠标移动和点击,键盘编辑,GPS信号随着时间的变化当用户移动自己的设备,陀螺仪信号,触摸时间等等。
  • 响应和处理任何磁盘或网络相关的异步IO事件(执行一个请求,时间执行,一个响应可能或者不能被收到,然后继续执行下一步工作)。
  • 处理被程序生产者推出的不可控时间或者消息(服务器发出的系统消息,上面提到的用户事件,硬件信号,传感器模拟事件的触发等等)。

Now, if the code in question is handling only on event stream, reactive-imperative programming with a callback is going to be fine, and bringing in reactive-functional programming is not going to give you much benefit. You can have hundreds of different event streams, and if they are all completed indendent of one another, imperative programming is not likely to be a problem. In such straightforward use cases, imperative approaches are going to be the most efficient because they eliminate the abstraction layer of reactive programming and stay closer to that for which current operating systems, languages, and compilers are optimized.

现在,如果所涉及处理事件流的代码,带有回调的响应式编程很不错,但是响应函数式编程并不会给你带来太多好处。你可以拥有数百个不同的事件流并且他们都是独立完成的,命令式编程不会有问题。在这种直接的情况下,命令式的编程时最有效的,因为他们没有响应式编程的抽象层并且容易被操作系统,语言和编译器优化。

If your program is like most through, you need to combine events(or asynchronous responses from functions or network calls), have conditional logic interacting between them, and must handle failure scenarios and resouce cleanup on any and all of them. This is where the reactive-imperative approach begins to dramatically increase in complexity and reactive-functional programming begins to shine. A nonscientific view I have come to accept is that reactive-functional programming has an initially heigher learning curve and barrier to entry but that the ceiling for complexity is far lower than with reactive-imperative programming.

如果你的程序是顺序的编程,你需要合并事件(或者来自函数和网络请求的异步响应),具有条件逻辑交互,而且必须处理失败的场景并且对其中任何一个进行清理。这时响应式编程范式开始急剧的复杂起来,但响应式函数式编程开始绽放光芒。我开始接受一个非科学的观点,响应式函数式编程有更高的起步曲线和入门的困难,但是编程难度比响应式编程要小很多。

Hence this is where the tagling fo Reactive Extensions(Rx) in general and RxJava specifically comes from, “a library for composing asynchronous and event-based programs”. RxJava is a concrete implementation of reactive programming principles influenced by functional and data-flow programming. There are different approaches to be “reactive,” and RxJava is but one of them. Let’s dig into how it works.

因此,Rx系列有一个总的标语,“一个为异步和事件编程的库”。RxJava是一个被函数式和数据流编程影响的响应式编程范式的具体实现。和”一般响应式“有一些实现的区别,但是RxJava属于其分支,让我们看看RxJava如何工作。

Reactive+Programming+With+Java+9-Packt+Publishing(2017).pdf At the moment, technology plays a major role in the success of businesses and in reaching out to more users as early as possible. This demand will increase day by day. Along with the increase in the demand, the user expectations also have increased. Now, the users are demanding a quick, more responsive, and reliable response. Reactive programming is a programming model that helps in tackling the essential complexity that comes with writing such applications. We, as Java developers, are very much familiar with the imperative style of programming; however, now to tackle the essential complexity, reactive programming uses declarative and functional paradigms to build the programs. This book aims at making the paradigm shift easily by discussing the concepts about functional programming in depth. This book begins with explaining what reactive programming and the Reactive Manifesto is, and about the Reactive Streams specification. It uses Java 9 to introduce the declarative and functional paradigm, which is very necessary to write programs in reactive style. It explains Java 9's Flow API, an adoption of the Reactive Streams specification. From this point on, it focuses on RxJava 2.0, covering topics like such as creating, transforming, filtering, combining, and testing Observables. It will then talk about how to use Java's popular framework, Spring, to build event-driven, reactive apps and its deployment on the server. By the end of the book, readers you will be fully equipped with the tools and techniques to implement robust event-driven reactive applications. 立即下载

相关推荐

Reactive Programming with RxJava epub

Reactive Programming with RxJava 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

RxJava实现响应式编程(Reactive Programming with RxJava)

本书已经全部翻译完成,地址在GitBook上,详情请查看: https://www.gitbook.com/book/piemonj/reactive-programming-with-rxjava/details 请在学习之前,保证有一定的Java8基础,否则学起来太吃力~~ 由于本人没有安卓经验,纯Java开发,所以安卓的实战那一节不会翻译了,感兴趣的安卓开发,可以在基础比较娴熟的情况下...

Piemon&Anokata的博客 2118

Reactive Programming with RxJava pdf 0分

Reactive Programming with RxJava 英文pdf

Reactive Programming with RxJava-Chapter1:Reactive Programming with RxJava

RxJava is a specific implement of reactive programming for Java and Android that is influenced by functional programming.

悟已往之不谏,知来者之可追 462

用R语言实现“中断时间序列分析” --- R code for ITS

ITS方法可用于评估一项干预措施的效果,从水平改变和斜率改变两个角度来描述干预引起的变化。

franksui的博客 4026

博途PLC S7-1200/1500 ModbusTcp通信SCL代码篇(轮询)

博途PLC MODBUS TCP的详细讲解和注意事项,可以参看下面这篇博文,这里不在赘述。这篇作为SCL代码篇主要给出SCL语言下的轮训写法和注意事项。博途PLC1200/1500PLC ModbusTcp通信(轮询处理)_RXXW_Dor的博客-优快云博客。............

RXXW_Dor的博客 8420

反应式编程(Reactive Programming)

本章将介绍该作品系列最后一种编程范式,也就是第🔟种编程范式--反应式编程(Reactive Programming),以及它的优缺点、案例分析和项目代码。

qq_40260394的博客 1561

芒果YOLO11改进172:ARConv自适应旋转卷积,全网首发 | 即插即用:以增强其表征能力,从而准确检测方向物体,ICCV顶会论文idea

ARConv自适应旋转卷积,全网首发 | 即插即用:以增强其表征能力,从而准确检测方向物体,ICCV顶会论文idea

包括YOLOv5、YOLOv7、YOLOv8等模型改进 1515

Reactive programming - 响应式编程

Rx 整理 概要 Reactive programming,响应式编程,是一种关注异步以及事件流的编程范式。 异步 Rx 通过观察者模式来 push 事件,避免线程阻塞的问题。所以能够很好地支持异步编程。 迭代器模式的同步 pull 与观察者模式异步 push 的比较 event Iterable (pull) Observable (push)

1819

STM32 之十三 看门狗(WDG)及低功耗下的处理

  最近在做低功耗项目时,遇到了看门狗不好处理的问题。在 ST 的各系列 MCU 中,看门狗应该算是使用配置起来最简单的一个外设了。我们通常仅需要配置很少的配置项,但是,一旦要配合低功耗模式则配置就比较麻烦了。MCU 中有两只狗,一只叫 Independent watchdog (IWDG);另一只叫 System window watchdog (WWDG)。下面是这两只狗的简单介绍! IWDG   IWDG 基本就等同于我们独立使用的看门狗芯片。最适合那些要求看门狗作为一个完全独立的进程在主应用程序之外

技术干货 7850

AutoSAR系列讲解(实践篇)9.5-通信的数据映射

讲解了AppL中的数据与通信中的Signal的一个映射操作

雪云飞星的博客 1万+

响应式编程Reactive Programming

作者: @andrestaltz 翻译:@benjycui、@jsenjoy 作者在原文后回答了不少人的疑惑,推荐一看。 在翻译时,术语我尽量不翻译,就算翻译了也会给出原文以作对照。因为就个人观察的情况而言,术语翻译难以统一,不同的译者会把同一个概念翻译成不同的版本,最终只会让读者困惑。而且术语往往就几个单词,记起来也不难。 作者在回复中提了一下FRP与RP是不同的

xinglinchunnuan_u的博客 851

Istio ICA考试之路---3-2

部署2个测试容器,分别是test和test2.test注入标签subset=v1。这里文档中省略了metadata的3行,可以从前面任意一个yaml复制粘贴过来。通过test2测试容器访问,50%概率触发500故障注入。通过test测试容器访问,20%概率触发延迟注入。发起20次请求,一共10次被500。

Q先生 725

Reactive Programming with RxJava-Chapter4:Applying Reactive Programming to Existing Application(2)

Replacing Callbacks with Streams Polling Periodically for Changes Multithreading in RxJava

悟已往之不谏,知来者之可追 315

ROS与深度相机入门教程:(1)Ubuntu16.04 在ROS中驱动Intel D435i深度相机

Intel在Github上开源了支持所有RealSense系列相机的SDK,包括了D400、SR300系列深度相机和T265双目跟踪相机,支持Linux、Windows、Mac OS以及Android,链接:https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installin...

m0_37957160的博客 2075

注意力机制模块:CA(坐标注意力)二次创新:融合深度可分离卷积,打造 CADS 模块

本文提出CADS模块,将坐标注意力(CA)与深度可分离卷积(DSC)深度融合,优化移动端AI部署效率。通过重构CA的计算范式,用深度卷积替代传统1×1卷积,在保持精度的同时显著降低计算开销。文章深入分析了CA的计算瓶颈和DSC的实际效率问题,详细阐述了CADS的设计原理与PyTorch实现,并提供了多组性能对比数据。该模块可直接应用于YOLO、UNet等主流模型,为移动端AI部署提供高效解决方案。

ZXSXJ的博客 96

【编程语言】响应式编程 Reactive Programming

响应式编程 Reactive Programming 响应式编程是一种异步编程范式,涉及数据流和变化的传播。 这意味着可以通过所使用的编程语言轻松地表示静态(例如数组)或动态(例如事件发射器)数据流。 作为向响应式编程方向迈出的第一步,Microsoft在.NET生态系统中创建了Reactive Extensions (Rx)库。然后,RxJava在JVM上实现了响应式编程。 随着时间的推移,Ja...

ss的程序人生 1670

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

解释Java中的反应式编程(Reactive Programming)和它的实际应用场景

反应式编程(Reactive Programming)是一种面向数据流和变化传播的编程范式。这种编程方式让开发者能够编写响应更快、更灵活并且更加可靠的应用程序,尤其是在处理高频率的数据更新和异步逻辑时。在Java中,反应式编程通过Reactive Streams规范以及各种库如Project Reactor、RxJava等得以实现。

java永无止境! 2292

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

RxJava学习资源

目前由于产品需求 要用到RxJava 所以开始学习和收集RxJava相关资源了,会一直更新。RxJava: Reactive Extensions for the JVM 它是响应式编程基于JVM的一个子集,相应的它还有RxSwift,RxGroovy,RxJS等各种语言的扩展,既然是响应式,就绕不开Reactive这个概念理论了,有些地方还会把它叫FRP(Functional Reactive

NoBlueSky的专栏 3663

5.从架构设计角度分析AAC源码-Rxjava2源码解析第0篇:Rxjava2开篇大纲

如果对RxJava2一点都不了解建议先去使用,再来(或者去)看Rxjava源码解析,否则云里雾里的很难理解Rxjava2。

foshengtang的博客 394

响应式java开发_# Java 响应式编程【Reactive Programming in Java】

最近学习RxJava。RxJava 在 GitHub 主页上的自我介绍:RxJava is a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences.翻译:RxJava是Rea...

weixin_34641420的博客 317

Reactive Programming with RxJava-Chapter5:Reactive from Top to Bottom(2)

Relational Database Access CompletableFuture and Streams Observable versus Single

悟已往之不谏,知来者之可追 381
上一篇: Android 7.0新特性
下一篇: Java面试题带答案
PirateBrook
博客等级 码龄11年 90粉丝 40原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值