English for RxJS Developers
Learn the English vocabulary for RxJS reactive programming: observables, operators, subscriptions, and subjects.
RxJS discussions lean heavily on precise verbs — emit, subscribe, unsubscribe, pipe — because the whole reactive model is built around a stream of events over time rather than a single value, and vague language quickly hides which part of the stream is actually misbehaving.
Key Vocabulary
Observable — a lazy stream that produces values over time and does nothing until something subscribes to it, the core building block of RxJS. “The HTTP request wasn’t firing because the observable was never subscribed to — it just sat there, cold and unused.”
Subscription — the active connection created when you subscribe to an observable, which must be unsubscribed from to stop receiving values and avoid a memory leak.
“We were leaking subscriptions on every route change because the component never called unsubscribe in its cleanup.”
Operator (map, switchMap, debounceTime) — a pure function that transforms, filters, or combines the values emitted by an observable, composed together inside a pipe().
“Swapping mergeMap for switchMap fixed the race condition, since it cancels the previous inner request when a new value arrives.”
Subject — a special kind of observable that is also an observer, letting you manually push values into the stream, often used to bridge imperative code into the reactive world.
“We used a Subject to push button clicks into the stream, since clicks aren’t naturally an observable source.”
Cold vs. hot observable — a cold observable starts producing values fresh for each subscriber, while a hot observable shares the same ongoing execution across all subscribers.
“The bug was that each subscriber triggered its own HTTP call, because the observable was cold — we shared it with share() to make it hot.”
Common Phrases
- “Is this observable cold, or is it already hot and shared across subscribers?”
- “Are we unsubscribing in the cleanup function, or is this going to leak?”
- “Which operator is cancelling the previous request here — is it
switchMap?” - “Is this a
Subjectbecause we need to push values in manually, or could this just be a plain observable?” - “Is this pipe doing too much? Can we split the transformation into named operators for clarity?”
Example Sentences
Reviewing a leak in code review:
“This subscription is never torn down — let’s move it into ngOnDestroy or switch to the async pipe so Angular manages it for us.”
Explaining an operator choice:
“We used debounceTime(300) before the search request so we’re not firing an API call on every keystroke.”
Describing a race condition fix:
“Search results were arriving out of order because slow requests could resolve after fast ones — switching to switchMap cancels the stale request entirely.”
Professional Tips
- Name the exact operator in play when discussing timing or cancellation bugs — “it’s not updating correctly” is much less actionable than “the
switchMapisn’t cancelling the previous inner observable.” - Distinguish cold and hot explicitly when a value seems to fire more than once — it usually means an accidentally cold, unshared source is being subscribed to multiple times.
- Flag missing unsubscribe calls in review as a leak risk, not a style nitpick — it has real memory implications in long-lived apps.
- Use Subject only to describe manually-pushed values — calling every observable a “subject” makes reviews confusing.
Practice Exercise
- Explain the difference between a cold and a hot observable in one sentence.
- Describe a situation where
switchMapwould be preferred overmergeMap. - Write a sentence explaining why a missing
unsubscribecall causes a memory leak.