Flow-based Programming

Panta rhei (Panta rhei) - Everything flows.

Software on FBP Website

JavaFBP uses Java threads, so it makes optimum use of all the processors on the machine running the application. The C# and C++/Boost implementations (see below) also use their respective thread mechanisms.

JavaFBP

After J. Paul Rodker Morrison retired from IBM, where the concepts behind FBP were originally developed for IBM main frame computers, and used for a number of production systems, he built an experimental implementation using C. A few years later John Cowan built a Java implementation, which was the first FBP implementation to use native threads, allowing it to take advantage of all the processors on the computer. This implementation, which has been undergoing continuous refinement and improvement during the years since, now called JavaFBP, is available as Open Source on GitHub. An older version is still on SourceForge, but is not being maintained.

Material on the syntax of JavaFBP component and network definitions and the component API can be found at JavaFBP Syntax and Component API.

In earlier JavaFBP versions, the scheduler presented an IIP to a component once per invocation. This has been changed as of JavaFBP-2.6 to once per activation.  In practice this will only affect "non-loopers" (components that get reactivated multiple times).  

Checking has been added (Aug., 2014) to make sure that all input connections have been provided. Since this was not being checked before, some users may have components that treat some input ports as optional. To make this explicit, a new optional parameter has been added to the InPort metadata. If this causes any problems for current users, please let us know.

Gradle is now being used for packaging. To build the project, make sure Gradle is installed, and then follow the instructions in the README file for this project.

JavaFBP Web Server

A simple server network written using JavaFBP can also be found on GitHub. The source code includes generalized components for Websockets Receive and Respond: WebSocketReceive.java and WebSocketRespond.java respectively. The former generates a substream for each incoming request from the client, comprising an open bracket, socket reference IP, data IP and close bracket, while the latter accepts a substream of any length, and returns all the contained IPs (except the first) to the client indicated by the first IP.

These two components are basically TooTallNate's AutobahnServerTest code, split into two processes, and require the Java-WebSocket-1.3.0.jar file, which is available on Maven central.

C#FBP

The C# implementation was originally created from the Java implementation by Amanda Ge using a conversion tool - it has since been extensively modified, but the two implementations are still fairly close. Material on the syntax of C#FBP component and network definitions and the component API can be found at C#FBP Syntax and Component API. This implementation is available as Open Source on GitHub. An older version is still on SourceForge, but is not being maintained.

In earlier C#FBP versions, the scheduler presented an IIP to a component once per invocation. This has been changed to once per activation.  In practice this will only affect "non-loopers" (components that get reactivated multiple times).  

Checking has been added (Aug., 2014) to make sure that all mandatory connections have been provided. Since this was not being checked before, some users may have components that treat some input ports as optional. To make this explicit, a new optional parameter will shortly be added to the InPort metadata. If this causes any problems for current users, please let us know.

CppFBP and Lua Interface

More recently (fall 2013), the C version mentioned above has been upgraded to use C++ and Boost, and is now called CppFBP - it also contains an interface component supporting the Lua scripting language, allowing FBP processes to be implemented as Lua routines.

Material on the syntax of CppFBP component and network definitions and the component API can be found at CppFBP Syntax and Component API. This implementation is available as Open Source on GitHub. An older version is still on SourceForge, but is not being maintained.

A component has been built for CppFBP which allows components (loopers or non-loopers) to be written in the Lua scripting language. We are now able to write multithreaded networks whose infrastructure is CppFBP, and where selected processes can be implemented using Lua scripts - in this environment the same Lua script can even be executing on multiple threads. Be aware, however, that non-loopers can be much slower, owing to the overhead of firing up a Lua environment each time.

Some examples of Lua scripts running under the generalized CppFBP Lua component (called ThLua) are shown in CppFBP/Lua Interface.

As Lua scripts communicate by way of character strings, if you need to pass more complex data structures through the network, you can also intermix CppFBP components in the same network - or other higher-level languages which play well with C++ and Boost.

This implementation is still under development (as of May, 2014), so there will be ongoing changes to the code and documentation.

JavaScript FBP Implementation

JSFBP is a traditional, "classical" FBP implementation. It can be used for batch processing, and possibly for server apps (it would support an approach similar to that shown on the cover of "Flow-Based programming", 2nd ed., similar to that used by Facebook's Flux), and should appeal to people who want to use the same language for both the client and the server sides.

JSFBP only requires the addition of a small package on top of node.js, node-fibers, which is easy to install. Even though it does not use pure JavaScript, neither does node.js, but the latter is becoming more and more accepted.

JSFBP takes advantage of JavaScript's concept of functions as first-degree objects to allow applications to be built using "green threads". JSFBP makes use of a "Future Events Queue" which supports the green threads, and provides quite good performance (average 88 microsecs per send/receive pair) - the JavaScript events queue is only used for JavaScript asynchronous functions, as before.

JSFBP's green threads do not take advantage of multiple cores, but neither did the first two FBP (green thread) implementations, including the one (AMPS) that had at least a few programs running for 40 years! But then, if I understand correctly, neither NoFlo nor JavaScript can take advantage of multiple cores either.

Re copying IPs, JSFBP is exactly like the other "classical" implementations - every IP has a lifetime from "create" to "drop", and it is owned by one process at a time. Once an IP has been "sent", it is no longer owned by the sending process, so it cannot be sent again by that process. Of course the process can take a copy before that point, and create a new IP using it, but then that will be a different IP. If the component wants to copy what I call an "IP tree", it can do that, but it is the component's responsibility, not the infrastructure's.

This implementation is available as Open Source on GitHub. It is still under development (as of Feb. 2015), so there will be ongoing changes to the code and documentation.

DrawFBP

A diagramming tool, called "DrawFBP", is also available on GitHub. An older version is still on SourceForge, but is not being maintained. We are in process of switching over to Gradle.

To build the project, make sure Gradle is installed, and then follow the instructions in the README file for this project.

DrawFBP supports a basic "block", representing any process, which can be given a process name - these should be unique within a diagram. However, a block does not need to be associated with a subnet or a simple component written in some programming language until the designer is ready to make implementation decisions. The "subnet" capability allows the designer to do stepwise decomposition - clicking on a subnet block brings up a tab showing the subnet, so the designer can easily move between the different levels of a diagram.

DrawFBP can also generate runnable networks in JavaFBP, C#FBP (with some tweaks to add components), NoFlo JSON, and the .fbp notation, originally developed by Wayne Stevens, and since adopted by the NoFlo project.

Diagrams are held in XML format, with an extension of .drw.

MergeSortDisplay

Simple DrawFBP diagram, showing both source code, and component classes.

Home