Reduce dependencies, enhance modularity, encourage the sharing of common logic, and improve testability

React and RxJs logos
React and RxJs logos
Image by the author.

Reactive programming is becoming a popular paradigm for frontend development. In this article, we aim to revisit the key ideas behind this concept, see a way it can be applied to React, and which benefits it can bring.

Adopting reactive programming and RxJs with React can help reduce dependencies, enhance modularity, encourage the sharing of common logic among apps, and improve testability.

Together with React, we will use only RxJs, the reactive extensions for JavaScript/TypeScript. No other external dependency will be required.

Reactive Programming: The Basic Idea

“Reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change.” — Wikipedia


Questo articolo è la traduzione dell’originale in inglese pubblicato su InfoQ.

“Dove mettiamo questo (Micro)servizio? E’ meglio una Serverless Function oppure un Container? O magari un Virtual Machine (VM) dedicata?”. Quando si progetta una nuova soluzione “pronta per il cloud”, queste sono domande che gli architetti prima o poi si pongono.

Come spesso accade, per questo tipo di domande c’è solo una risposta valida: “dipende”. Non solo “dipende”, ma “può anche cambiare”. La soluzione ottimale presa in un certo momento può diventare fortemente sub-ottimale nell’arco di pochi mesi. Al lancio di un nuovo prodotto o servizio può essere conveniente optare…


Today maybe there are tools better than Java to develop applications on top of modern architectures

Microservices and Containers are very popular today, even in traditional corporate IT shops. Often though they are implemented using languages, such as Java, born in the early ’90s and designed for a world of monolithical applications. Do you remember the big old Application Servers?

Sometimes this choice is driven by solid reasons: need to integrate legacy systems via libraries present only in the Java ecosystem, convenience to use skills already in house. Often, however, this choice can derive from a not careful evaluation of the alternatives which are available today and the benefits (economic and of performance) they can bring.


Lambda Calculus in a typed world

Lambda Calculus is a “is a formal system in mathematical logic for expressing computation” based on the concept of functions and defined by Alonzo Church in 1936.

Alan Turing demonstrated that Lambda Calculus and Turing Machine are equivalent, and therefore that Lambda Calculus is Turing complete. This means that any computation can be performed using Lambda Calculus.

Some may feel that approaching Lambda Calculus with pen and paper can be difficult, very much abstract, tedious to work with.

The cool thing is that Lambda Calculus, as we said, is based on the concept of functions, which is something that programmers…


For a rational choice we need to consider other more important elements.

I often happen to stump into posts comparing Java and Go. Almost always, at the center of the comparison is either the speed of execution or the presence/lack of specific features (usually absent in Go and well established in Java).

So if one writes that Go is awesome, there are tens of replies stating that Java is much better because “there is this benchmark that proves Java is much faster” (plus it has Generics and also try-catch). Then you read the “benchmark “that states that Java is faster than Go, and you find another flock of comments sustaining the opposite.


Forse oggi ci sono strumenti migliori di Java per sviluppare applicazioni su architetture moderne

Da qualche anno stiamo assistendo ad una sempre più estesa adozione delle architetture a Microservizi che si appoggiano su containers. In contesti IT di tipo tradizionale, spesso le troviamo utilizzate con un linguaggio di programmazione quale Java, nato nei primi anni ’90 e progettato per un mondo di applicazioni monolitiche (vi ricordate i cari vecchi Application Servers?).

A volte questa scelta è dettata da solide ragioni: necessità di integrare sistemi legacy tramite librerie presenti solo nell’ecosistema Java, convenienza ad utilizzare competenze già esistenti in azienda. …


The Sieve of Eratosthenes algorithm implemented using streams, recursively

The Sieve of Eratosthenes: prime numbers as stream

Prime numbers can be conceived of as an infinite stream of integers: 1, 2, 3, 5, 7, 11…etc.

More than 2.000 years ago, the Greek mathematician Eratosthenes discovered that prime numbers can be calculated using streams in a recursive way.

In this article we will see a couple of different implementations of such logic, one using RxJs and Typescript, the other using Go channels as streams.

“Sieve of Eratosthenes” With RxJs Observable Streams

To start our calculation we need to generate a stream of all integers, starting from 2, which is going to be the source used by the algorithm. …


Lambda functions and WebSockets — how the opposites meet in the cloud

Image credit: Author

Lambda functions and WebSockets can be seen as concepts difficult to reconcile. Lambdas are ephemeral by nature. They appear when invoked and then disappear sometime after they have finished working. WebSockets, on the contrary, maintain stable, long-living connections between one server and many clients.

The AWS APIGateway offers the possibility to bring these two things together, combining the advantages of the Lambda on-demand model with the power of WebSockets’ real-time bidirectional communication.

In this article, we describe how to implement a WebSocket server using AWS API Gateway and Lambda functions. …


Suppose you have to add a new major feature to an app. Which of the 2 scenarios is easier?

  • add the feature to a relatively small app, still under construction, not yet in production
  • add the feature to an app that has grown over time, whose overall quality is questionable, which is already running in production serving several clients

Well, there is no doubt. The second is a much more challenging task.

But then why do we usually find a more senior experienced team in the first and more junior teams buried in the second?

Many years ago

When I entered the team…


Real-world scenarios from Stack Overflow

Image source: Author

Reactive programming is getting traction and so is the use of ReactiveX libraries. More and more people start using this paradigm and often face similar problems in their learning path. Similar problems call for similar solutions, and this is what patterns are.

An interesting source to understand real-life problems is Stack Overflow. I started looking at the questions around RxJS some time ago, and I’ve noticed some recurring themes and similar situations that people have to deal with.

One popular theme is around asynchronous API calls; in other words, how to deal with HTTP requests in the real world. …

Enrico Piccinin

A man with passion for code and for some strange things that sometimes happen in IT organizations. Views and thoughts here are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store