DEV Community

Cover image for Streams Oriented Programming: an introduction
Dario Mannu
Dario Mannu

Posted on • Edited on

3 1 1

Streams Oriented Programming: an introduction

If your app is all made of reactive streams plugged to the DOM by your framework, shall we give it a fancy name?

We could call it "Streams Oriented Programming", as it captures its essence very well.

What is this all about, exactly?

A programming paradigm, mostly derived from principles of Reactive Programming, in which you define everything as streams. Pretty much everything is (=can be, to be more precise) a stream that speaks the same language. If you use Observables, their "communication protocol" is subscribe/next/error/complete. You can use other patterns, different than just Observables, such as Callforwards, Callbags, Signals.

Image description

Why is this good for you?

Think of LEGO bricks: you can compose them so easily that every kid can do it.

If your apps all implement a unified compositional model, it becomes trivial to build large, complex applications that display higher quality and maintainability properties, in addition to a sharp reduction in the amount of code you'll write.

What are the top use cases?

Big Data ETL pipelines have done this since the age of scalability in a more or less informal way.

UI development in general is a great candidate because it hasn't broadly adopted this model and it's a great fit because everything can be represented as a stream: from clicks on a button which you turn into text to show on a page, to navigation, views, sequences of dialog boxes (wizards).

In JavaScript, most UI libraries or frameworks are conceived for the imperative programming paradigm, so this paradigm is novel.

Image description

LEGO bricks vs Jigsaw puzzles

Which comparison fits this paradign in a fair way?
Lego bricks you can be attached in a quite disorderly manner. On the other hand, jigsaw puzzles take a long time, especially at the beginning, to find two matching pieces.

Having worked with 100% streams-based simple and large enterprise applications I would say both can apply. When apps are small and simple, it's really like playing with LEGO bricks. When creating complex enterprise apps, the unique shape of each piece in the puzzle helps you only connect compatible pieces together...

Streams in action

If you'd like to see streams-based programming in action, you may want to check out rimmel.js, the only JavaScript UI library taking the "everything is a stream" approach. The results are remarkable.

Want to see concrete examples? Have a look at this Stackblitz collection

Learn More

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay