An overview of RxJS reactive concepts

André Staltz
InstructorAndré Staltz
Share this video with your friends

Social Share Links

Send Tweet
Published 9 years ago
Updated 5 years ago

This video gives an overview of the concepts of reactive programming we saw during this series, and explains how reactive programming can provide true separation of concerns.

[00:00] Let's zoom out a bit and see what we accomplished. The first thing that you notice from this code, it basically only has var declarations and function definitions. It's a fully declarative code.

[00:13] Apart from, of course, the subscribes here at the bottom. These look somewhat familiar. They are not that much different from document.addEventListener. Giving a custom event such as suggestion one, and a call back. This is pretty much the same idea as this.

[00:36] How did we create our custom events? Well, we did that by applying functions, such as map and merge and flatMap, based on simpler events, such as response, stream, and close, click streams and refresh click streams. That kind of stuff.

[00:55] We learned that everything can be an event stream. We can have an event streams of clicks. We can have event streams for promises, and we can have event streams, also, for data, such as these.

[01:08] Then also look at how we have virtually no control flow keywords here. We don't have ifs, we don't have elses, we don't have for-loops. All of this was created with operators such as map and filter and flatMap. These operators are really important for programming, and they will be your new ifs and for-loops.

[01:34] Finally, let's look how reactive programming brought true separation of concerns to our code. If you want to see how the first user data behaves over time, you only need to look at its declaration.

[01:48] The declaration specifies the complete dynamic behavior over time. There cannot be any other code that will modify the user data. That's a really good guarantee. You can be sure you know, 100 percent, how the user data works just by looking at its definition.

[02:09] That's it and I hope you enjoyed learning about reactive programming in JavaScript.

Tony
Tony
~ 8 years ago

This video is incomplete. It appears that the full video is ~4 minutes and this one is ~2 minutes. That would explain why it seems to start mid-lesson.

Olivier Clément
Olivier Clément
~ 8 years ago

To the two previous commenters:

This video is the last of a serie of 10 You should have the playlist displayed under the video; If not, just go there: https://egghead.io/series/introduction-to-reactive-programming

Joel Hooks
Joel Hooks
~ 8 years ago

Is this not what you see?

These comments confuse me a bit.

anurag
anurag
~ 8 years ago

How can I implement backoff technique in Reactive Programming? could you give a example for me? Thanks, Anurag

animeshjain
animeshjain
~ 8 years ago

Excellent lessons André

Minor suggestion : I think it is more elegant to use startsWith in creating the requestStream, instead of merging with a startStream. Just thought I'd add it here

var requestStream = refreshClickStream
  .startWith('https://api.github.com/users')
  .map(ev => {
    var randomOffset = Math.floor(Math.random()*500);
    return 'https://api.github.com/users?since=' + randomOffset;
  })
;
Terry DI LUZIO
Terry DI LUZIO
~ 7 years ago

Great course Andre, really helps to grasp this approach

Alex
Alex
~ 7 years ago

Interesting walkthrough for RxJS start. I did expect you join 3 users also under one roof as this would also help understand abstracting it better.

Tadeusz Rychter
Tadeusz Rychter
~ 7 years ago

Same here - that's the part I'm missing.

Dr.Emmett Brown
Dr.Emmett Brown
~ 7 years ago

this is really good RX course ( introduction to middle level flavor ) to understand that what's happening behind of the Rx :)

Thank you for your effort and to make it understandable in a very short time.

I really like it..

hamid
hamid
~ 7 years ago

really thank you for Awesome enlightenment over how to last in the Reactive world!

Markdown supported.
Become a member to join the discussionEnroll Today