Flow-based programming is a method of designing computer applications and architectures that is unlike traditional structured methods of application design in that data are intended to be processed in a stream by components that are not connected to one another and use an external messaging system to communicate. Under flow-based programming, the focus is placed on transforming data by using different components, which essentially are encapsulated modules or functions that have no direct connection to the other components in the program. Each of the data streams and other events is managed by an external system of message passing that is not unlike some types of network protocols, in which an information packet (IP) is delivered to a module through the use of an abstract port. This component-based design view allows an application to have separately developed code modules that only need to respond to a system message, process an IP and then release the IP back into the system. This approach is useful on distributed systems, networks and with Internet and web-based program architectures such as e-commerce servers.
One of the fundamental building blocks of flow-based programming is the idea of an isolated node, process or module. This can be thought of as a piece of program source code that does not have any direct dependencies on any other modules, almost making the module a stand-alone piece of the application that can be called whenever it is needed. Each component has no reliance on being called sequentially with another component, so the components of an application can be arranged and used in any order, allowing multiple unique dataflows to exist as information moves through the system.
Each of the individual modules in flow-based programming accepts data through an abstract interface known as a port, which operates much like a data port within a computer network. Data are sent to a port through a buffer that is a limited size but turns multiple IPs into a stream that is constantly fed to the port. A single port can relate to several instances of a single component, making the structure easy to use on a distributed system or for parallel processing.
The data contained in an information packet are maneuvered through the modules by an external messaging system. In flow-based programming, this messaging system is separate from the modules and IPs and only manages the program flow through the use of buffers that are bound to ports. The messaging system basically has no knowledge of what the modules are or are doing and no real concern about what data are contained within the IPs the modules are processing.
The divisions and modularity of each of the components that constitute flow-based programming applications lend themselves well to processes such as debugging and team-oriented development. Much of the code is encapsulated, so source code has a high reusability potential. This also means that upgrading or scaling an application that uses flow-based programming can be easier than with a more integrated application, because the messaging system, the modules and the port system can each be independently changed without affecting the larger program.