Twitter is the opposite of NodeJS

Venkat
2 min readDec 16, 2015

--

It is possible to see Twitter and NodeJS as ecosystems in which nodes (people, systems or functions) consume alerts and emit alerts. This perspective can bring out a very interesting relation between these two seemingly unrelated systems.

In Twitter, nodes demand that they can only receive alerts from certain other nodes (subscriptions). In NodeJS, nodes demand that their alerts be posted to certain other nodes (calls/dependencies).

In Twitter, a node emits to a single channel and does not specify which nodes can receive the alerts from this channel. In NodeJS, a node can receive alerts on a single channel (function call) and does not specify which nodes can send them alerts (call this function) on this single channel.

In Twitter, the nodes are mostly humans and a few systems (broadcasting updates). In NodeJS, the nodes mostly software components and a few humans as well (workflow workers).

Twitter’s job is to deliver the alerts by honoring the receiver’s demands (subscriptions). NodeJS’s job is to deliver the alerts by honoring sender’s demands (calls).

By the way, NodeJS is nothing special here. I just considered it as a representation of a software system in which functions are the capsules of processing logic. However any software system would also fit into this description if the object/class abstractions do not dominate the functions.

The General Theory of Alertivity

An alert system has alerts, channels, nodes and a platform (background radiation). The system is a directed graph with channels as edges and nodes as vertices.

Consumption of an alert could result in
- changes caused (work done) by a node (function/people/system)
- sync’ing of info among nodes
- ignoring (no effect)

Functions are nodes that can consume a single alert type (invocation). An object/class/thread provides an additional context for a function alongwith it’s input arguments.

There are systems that work like Twitter and NodeJS at the same time. That is, these systems can accept subscriptions and invocations as well. Imagine a different Twitter in which you can choose other people who must receive updates from you, and you have no control on who can send updates to you. That sounds awful, but actually that is what happens with email and work situations.

Also, these two models correspond to the two fundamental team-work models. The two team models are sequential (assembly line or workflow) and parellel (map-reduce). Twitter model maps to parallel teams for sync-up while NodeJS model maps to sequential teams for work-passing. More on the team work in the next post.

--

--