switchMap? Why Not Restart Observable? - A Tiny Snark Free Jamboree
switchMap? Why Not Restart Observable? - A Tiny Snark Free Jamboree

Wednesday • February 5th 2025 • 11:55:06 pm

switchMap? Why Not Restart Observable? - A Tiny Snark Free Jamboree

Wednesday • February 5th 2025 • 11:55:06 pm

Switch Map, is a strange name for anything, outside of the reactive programming community.

In the reactive programming community, it is a combination of two meanings.

Where switch refers to Observables, and Map means change on thing into another.

You may not use, a correct name, which is Swap Observable.

Because, you will then fail to speak the same language, as the members of the Functional Reactive Programming Communities.

How are you supposed to know the strange meanings, and the subset of language?

That is illustrated by a quote, from the 1991 Pointbreak surfer movie:

“Well, look. Look at 'em. They're like some kind of tribe. They got their own language.”

You either have to practice a lot, or stalk your prey for long enough.


I once saw a piece of code I couldn't read, it contained map, reduce, and filter, and it to me it looked like jewelry.

It took weeks of being mindful of existence of map and reduce, to finally click with it and in my case start writing CouchDB queries.

Which some consider to be a fire-able offense, on par with speaking the f-word to the next upper ranking employee.

As beautiful as that map reduce code was, it hurt me, it told me I was left out, and not capable of higher beauty.


The word switch, gained it significance for me, when I saw that it only refers to observable under RxJs.

There are three operators there, switchMap, switchMapTo, and switchAll, whose marble diagram is the f-Word illustrated.


Functional reactive programming, is not necessary, but it is the beautiful magic of a sorceress, or enchanters, or a wizard.

It is the escape from the mundane, it is how you rise above prestigious small minded men, who think they have it all.


Finally, I will always recommens that you learn FRP, by building your own Functional Reactive Programming system.

And you can see how that eases you into the community, where you pickup the language.

But, if you are looking to learn Reactive Programming in JavaScript, right, real quick.

Then I recommend looking at the Observables Proposal, from The Web Incubator Community Group (WICG).

They don’t carry the Observable it self, that you will find at the Technical Committee 39 Observable Proposal

Aside from The Web Incubator Community showing you nice code examples, along side their ugly imperative versions.

They also name the 15 essential functions that you can start with, a familiar list that is nowhere as nearly overwhelming as Rx operators.

And I will close this text, by naming them for you:

from, map, flatMap, filter, reduce, take, takeUntil, drop, some, every, find, forEach, toArray, catch, and finally.

Artwork Credit