Skip to content

Instantly share code, notes, and snippets.

@headinthebox
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headinthebox/cdb50343828d7da494cb to your computer and use it in GitHub Desktop.
Save headinthebox/cdb50343828d7da494cb to your computer and use it in GitHub Desktop.

A playful introduction to Rx

Learning Rx does not have to be boring or painful working your way through theoretical sermons about esoteric concepts like category theory and duality. Life is too short for that kind of abstract nonsense.

So what is a better way to spend a hot summer day with an ice-cold drink, or dually, a cold winter night with a piping hot drink, than to learn Rx by writing an awesome platform game. In this talk, I will walk you through many of the features of Rx by way of scripting a friendly bug to run across a lavish grass meadow and jump for the stars. In just a few tens of lines of code, we will leverage operators like map, flatMap, filter, scan, and many more to react to the keyboard, animate jumps, and perform collision detection. We will even use a test scheduler to make the game run at a speed we determine so we can easily debug and test our game.

We will use RxScala and IntelliJ to develop the game, but since Rx is language and platform agnostic we show snippets of the same game implemented using RxJs and Rx .NET as well. Of course, all the source code will be available for your entertainment on GitHub.

Once you have mastered elementary game development using Rx, you are more than ready to go on and build reactive, event-driven, scalable, and resilient enterprise systems for your pointy-haired boss. But until then, devs just wanna have fun.

@meisinger
Copy link

Remove the "a" in "So what is a better to spend" (second paragraph)

@mattpodwysocki
Copy link

@headinthebox I'm more than willing to help out with the RxJS version of this.

@evincarofautumn
Copy link

  • boring or painful working → boring or painful—working
  • lavish grass meadow → lush grassy meadow
  • language and platform agnostic we → language- and platform-agnostic, we
  • (hot day → cold drink) and (cold day → hot drink) aren’t quite duals. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment