What does it mean to be Reactive by Erik Meijer


Rethink about what we build
What is Functional Reactive Programming

There’s something about the culture of software that has impeded the use of specification. We have a wonderful way of describing things precisely that’s been developed over the last couple of millennia, called mathematics. I think that’s what we should be using as a way of thinking about what we build.
By Leslie Lamport

Denotational Semantics
Axiomatic Semantics
Operational Semantics

Every program you write has some combination of side effects. And some part of your program are reactive, some part of your program are iteractive. Some part of your program are functional. Some part of your program are imperative. So, just singly out of one thing, in my opinion, not a good thing. We should just do what’s right. And what’s right is just picking the effect that matters. : )

Streaming and event-based programming using FRP and RxJS by Matthew Podwysocki


Reactive Streams
Reactive Extensions

We are dealing notion of time, because obversable are really a notion of value over time.

Obversable, the idea of future values.

// future value example
var randomNumbers = Obversable.create((s) => {
var i = setTimeout(() => {
}, 1000);
return () => clearTimeout(i);

randomNumbers.subscribe(x => console.log('1: ' + x)); //1: 0.1231231
randomNumbers.subscribe(x => console.log('2: ' + x)); //2: 0.5612323

The other “ideas” of values

SYNCHRONOUS Function Enumerable
ASYNCHRONOUS Promise Obversable

Design, Composition, and Performance by Rich Hickey



Good Design
Separating into things that can be composed.
Design is about taking thing apart in such way that they can be put back together.

Design is imagining
It’s not solving the problems that you ever meet before.
You are facing some sort of problems that you have to imagine potential solutions.

Embrace the constraints.
Only we have enough constrains, we can make up some thing that will work.

var outcome = design(constraints)

You want to think for 10 things and then say, this one is what we want to do.

We want to admit very little, we want to be able to say no.

Design is about making decisions
The value that you conveyed in your design is strictly about the decision you make.
Leaving all options open is avoiding design. Everything are configurable, that’s not design. That’s like do your own thing.

Take things apart(Over and over agian)
Design (Communicate very well, be able to work in multiple levels)
Code (take prepare and experiences. Real experiences with doing thing, not experience by doing the same thing over and over agian)
Pick up Langs and libs like instruments (Oriented around that people know how to use them)
Pursue harmony (What makes thing work well together and apply them)

Morris Traversal - Algorithm


Morris Traversal is a way to traverse the tree without using any extra space.

It is inspired by the Threaded Binary Tree. In threaded binary tree, with setting some extra pointers, it’s possible to cheaply find its successor.
The Morris Traversal leverage the rightmost node, so the space complexity is O(1).
Let’s see how it works.

The pseudo code of inorder Morris Traversal is listed below,

  • Initialize current as root
  • while current is not Null
    If current doesn’t have left child
    • Print current’s data
    • Go to the right, i.e., current = current -> right
    • Make current as right child of the rightmost node in current’s left sub tree
    • Go to this left child, i.e., current = current -> left