Tag Archives: RxJS

Reactive (in RxJS) and Non-Reactive (in Scala) Snakes And Ladders


via Reactive (in RxJS) and Non-Reactive (in Scala) Snakes And Ladders | Software Artisan’s Blog.

While playing around with RxJS, I thought it would be interesting to create a Snake and Ladders game that I played during my childhood days. A typical game is played by 3-4 players with a board size of 100 cells and a dice. The board has snakes and ladders on it. Rules are very simple; when a player ends up in a position where the ladder starts, it gets a lift to a position where the ladder ends and if a player ends up in a position where a snake’s mouth starts, it gets gulped down by the snake and reach the tail as a new position. Otherwise, the player moves to a new position from the old by the throw of a dice. Players take turn at throwing the dice.

In the reactive version using RxJS, lets start with a generator that would push a player (represented as a value starting from 0 for first player, 1 for second player and so on…) every few milliseconds, in my case 100ms. In the increment function, lets bump up the value by 1 and finally in the ‘Return Value’ function where the generated numbers are cast out by the number of players using mod operator. So if there are 3 players, the first player would start at 0 and the third would have number of 2. I’m using Node.js to run this and have imported the RxJS module. Here is what I ended up creating for starters.

Authenticable Observables: Build a Reactive App with JWT Auth


via Authenticable Observables: Build a Reactive App with JWT Auth.

Reactive programming is powerful and is becoming increasingly popular with libraries such as RxJS. We can make a stream out of just about anything, including API communication and authentication. Check out the repo for this tutorial to see the code.

Video: Mastering JavaScript Flow Control


Everyone knows promises can help flatten the JS pyramid of death. But promises aren’t the only solution available. I’ll discuss some more advanced techniques surrounding the flow of information through your application through the use of libraries such as AsyncJS and RxJS. I’ll also talk about how embracing streams can not only alleviate control flow issues, but also improve performance. Finally, we’ll look into how tools such as ZeroMQ and Redis can help to foster asynchronous and event-driven APIs.

Johnny Austin is a full stack software engineer with an interest in everything from user experience to systems architecture. He specializes in all things JavaScript but has experience with Java, Ruby, Go and Python. Johnny is an active member of the open source community – contributing to projects such as Node.js and many more. Currently, Johnny is crafting masterpieces as a Creative Technologist at iStrategyLabs and occasionally teaches courses at General Assembly.

Using React.js & RxJS to Create a Scroll Table with a Dynamic Width


via Using React.js & RxJS to Create a Scroll Table with a Dynamic Width | Codementor.

Lots of people have very romantic thoughts about building the perfect web app with everything flowing so smoothly, with very clean definitions of what is to be expected where. A lot of people also believe in creating React components that have all of their JSX in the render method, where they can be sure that a lot of the other lifecycle events that aren’t too pleasant or “declarative” can be avoided.

Unfortunately, this is not one of those posts. I make heavy use of very ugly parts of React and modify the DOM as I see fit in order to do what is easiest for me to do. And really, if a components shits all over your DOM but still adheres to the component tree and cleans up after itself, was there really shit in the forest? Probably, but let’s not worry about the that for now.

The Future of Programming: WebAssembly & Life After JavaScript


via The Future of Programming: WebAssembly & Life After JavaScript.

Recently we heard that the web platform is getting a new browser-native compile target called WebAssembly (see What is WebAssembly: The Dawn of a New Era for details). Wasm makes the web platform a more attractive compile target for other languages. That leaves us wondering what might come after JavaScript.

JavaScript has some great features, but I sincerely hope we move on as soon as possible. JavaScript is great and it taught us a lot, but programming will evolve. There will be life after JavaScript.

I’m not a fan of C++ (I’m a recovered user and abuser of C++), but I am a fan of many things built with it, including the Unreal Engine, which runs great when compiled to JavaScript. There’s no good reason to write everything in JavaScript forever. It’s time to look to the future.

I’ve been using and really enjoying CoffeeScript from time to time, which helped inspire a lot of the new ES6 features. CoffeeScript feels much simpler than JavaScript. It has a more concise syntax, yet adds a lot of expressive capability that did not exist in ES5. Of course, I’d simplify CoffeeScript even more by ridding it of the poisonous class keyword. I like to fiddle with Haskell, too. But these languages represent the present.

So what could we do next?

Whatever catches fire after JS, I hope it has these features:

  • Built-in immutable data structures and immutability by default.
  • Literal forms for objects, collections, and primitive types.
  • A better default number type for most use cases.
  • Custom structural types, including good support for low-level binary types (bonus if we get definable literal syntax).
  • Lambdas with closures.
  • Functional utility belt built-in. Similar to the RxJS Observable API.
  • Native support for object and factory composition. Something like built-in stamps.
  • Realtime guarantees for low-latency processing & precision scheduling for apps like gaming, music & video production, DSP, scientific applications, synchronization of distributed systems, etc…
  • Minimal syntax, similar to Ruby, Python, or CoffeeScript. Now that I’ve had a chance to get comfortable without curly braces and semicolons everywhere, I feel a lot less confined by syntax.

Video: RxJS for Metrics and Music