News for hackers. Stuff that matters.
Re:Flow-Based Programming by samuell on Wednesday January 20, 2021 @01:14PM (#25849806)
Actor systems differ in their means of communication. While actor systems use the actors as the main units that you connect, with fire and forget messaging to each actor's inbox, FBP proposes communication between named ports over channels with bounded buffers, very much like the CSP implementation in Go (just that you have long running components as in actor systems - something that can easily be implemented in Go with structs with go channels in fields for the ports, as shown in the FlowBase library I mentioned in another comment).

The FBP model provides implicit backpressure, because of the bounded buffers on the channels. The actor model on the other hand is more loosely coupled and flexible.

This actually means FBP systems are slightly more optimal for efficient within-one-node, in-memory parallellisation, whereas actor systems shine more for distributed systems.

They shine on different scales, in other words.

I wrote a post many years ago on this, that seems to have aligned with the experience of a number of people, based on the reactions in the comments: https://rillabs.com/posts/flowbased-vs-erlang-message-passin...

Re:Flow-Based Programming by Nullabillity on Wednesday January 20, 2021 @01:45PM (#25850228)
Akka Streams adds named ports and defined backpressure, as well as a graphical-ish DSL for connecting everything.[0]

[0]: https://doc.akka.io/docs/akka/current/stream/stream-graphs.h...

Re:Flow-Based Programming by jghn on Wednesday January 20, 2021 @06:57PM (#25853526)
It is worth noting that Akka Streams is an implementation of the Reactive Streams [0] spec, using Akka

[0]: https://www.reactive-streams.org

Re:Flow-Based Programming by samuell on Wednesday January 20, 2021 @01:59PM (#25850415)
That is nice to see! I was evaluating Akka a bit some years ago.
Re:Flow-Based Programming by rad_gruchalski on Wednesday January 20, 2021 @07:09PM (#25853631)
AkkaHttp is written on top of Streams. There are many more things written using it but Http is a good example to learn from.
Re:Flow-Based Programming by bcrosby95 on Wednesday January 20, 2021 @01:57PM (#25850398)
> The FBP model provides implicit backpressure, because of the bounded buffers on the channels. The actor model on the other hand is more loosely coupled and flexible.

Note that this is why people recommend using GenServer's "call" instead of "cast" in Elixir/Erlang by default - it applies a sort of backpressure because call waits for the process to return a result rather than being fire and forget.

It's not exactly the same thing, or as configurable as Go channels, but it is an option.

Re:Flow-Based Programming by pythonaut_16 on Thursday January 21, 2021 @02:30AM (#25856452)
Elixir has several tools built around solving this problem; GenStage being the foundation library and Flow and Broadway at a higher level.
Re:Flow-Based Programming by samuell on Thursday January 21, 2021 @04:51AM (#25857202)
On a related note, there's also work on an FBP implementation in Elixir: https://github.com/pcmarks/ElixirFBP
Re:Flow-Based Programming by didibus on Thursday January 21, 2021 @12:42PM (#25861636)
What's curious is that CSP started with named ports as well, but evolved to become anonymous.

> Programs in the original CSP were written as a parallel composition of a fixed number of sequential processes communicating with each other strictly through synchronous message-passing. In contrast to later versions of CSP, each process was assigned an explicit name, and the source or destination of a message was defined by specifying the name of the intended sending or receiving process

I wonder what gives? Why this return to an older form?