{"id":19340209,"url":"https://github.com/flowbased/thinking-flowbased","last_synced_at":"2026-03-01T12:34:10.863Z","repository":{"id":31367643,"uuid":"34930601","full_name":"flowbased/thinking-flowbased","owner":"flowbased","description":"A pratical book for how to program using flowbased- programming","archived":false,"fork":false,"pushed_at":"2015-08-12T10:28:53.000Z","size":136,"stargazers_count":14,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-24T08:32:00.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flowbased.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-02T00:45:21.000Z","updated_at":"2021-08-16T13:49:41.000Z","dependencies_parsed_at":"2022-09-13T08:52:52.494Z","dependency_job_id":null,"html_url":"https://github.com/flowbased/thinking-flowbased","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flowbased/thinking-flowbased","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Fthinking-flowbased","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Fthinking-flowbased/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Fthinking-flowbased/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Fthinking-flowbased/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flowbased","download_url":"https://codeload.github.com/flowbased/thinking-flowbased/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Fthinking-flowbased/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:25:40.413Z","updated_at":"2026-03-01T12:34:05.849Z","avatar_url":"https://github.com/flowbased.png","language":null,"readme":"\nThinking Flowbased Programming\n==============================\nA pratical book for how to program\nwith flowbased- or dataflow programming.\nAimed especially at programmers who have\nsome experience with imperative \u0026 object-oriented programming.\n\nFocused on general purpose programming,\nand independent of a particular FBP implementation.\n\nIntended primarily as an e-book,\nbut also publishable on dead trees.\n\nWhen and when not to use dataflow/FBP\n=====================\nWhat is it particularly well suited for, which things are tricky.\n*NB: potentially very subjective*\n\nDomains where dataflow is commonly used\n\n* image processing\n* video processing, compositing\n* audio processing\n\nImportant to note that dataflow/FBP and imperative/OOP is not\nexclusive, but instead complimentary:\n\n* Components are typically implemented in imperative code\n* Can send/receive data from FBP network (short- or long-lived) in imperative code\n* Can use FBP for parts of problem, communicate using IPC/database\n\nBenefits of FBP\n============\n\nAs compared to 'typical imperative code' (whatever that is...)\n\n* Enforced encapsulation. Ease of reasoning, testability\n* Executable architecture diagrams. Ease of onboarding, architecture discussion\n\n\nImperative concepts\n====================\nWhat do they map to flowbased ones,\nwhich patterns can be used by each\n\n\"variables\" \u0026 \"state\"\n--------\nUsed for many different purposes...\n\nLocal versus shared/global.\nShared state should be expressed as data in network.\nLocal state can be done inside components.\n\nconditions (if, else)\n----------------------\n\nMaps to routing and/or filtering components.\n\nloops (for, while)\n-------------------\nUsed for several purposes\n\n* *reduce* set of values to single value. Ex: SUM\n* *map* set of value to another. Ex: Vector add\n* *filter* to create new set of values. Ex: values bigger than threshold\n\nfunctions\n-----------\nUsed to reuse code in multiple places.\n\nMaps roughly to components.\nFunctions calling other functions is like a subgraph.\n\nclasses, inheritance\n------------\nUsed for:\n\n* interfaces\n* traits/mixins\n* resusing code\n\nmember variable\n\n* collecting related state\n* maintaining state over multiple function calls\n\nsequencing\n------------\nDoing things step by step. \"first A, then B, then C\"\nhttps://github.com/noflo/noflo/issues/284\n\n* recursion\n* call/return\n\nconcurrency (threads, mutex, semaphores)\n------------------\n\ncomposite data (structs, objects)\n---------------\n\n\ncollections (array, dictionary, sets)\n----------------\n\nDictionaries sometimes used for dynamic dispatch.\n*Dynamic dispatch* between finite set of dispatch handlers known at programming time:\ncan be done by using a routing component to send input to correct handler,\nthen using a merge component to send handler output to a single output\nSome FBP implementations allow changing components/networks on the fly. Only use as a last resort.\n\n\nFlowbased concepts\n==================\nTODO: refer out to books for source of definitions\n\nCentral definitions\n\n* Component: \n* Port:\n* Process: Component instance\n* Connection: \n* Graph: definition of \n* Network: Graph instance\n* Packet:\n* IIP:\n\nCommon classes of components\n\n* routers\n* filters\n\nFiring patterns\n\n\nThings hard to grasp\n================\nFor those used to imperative programming.\nSome of these might not be unique to dataflow/FBP\n\n* data-driven programming, as opposed to instruction-driven\n* asyncronous thinking, multiple-entries of functions (at later time)\n\n\nSoftware engineering practices\n====================\nThings that might go outside a narrow view of programming,\nbut are essential to programming from a software engineering\nperspective.\nOr aspects of software design which influences how software\nshould (as opposed to could) be made.\n\n* organizing bigger systems. Subgraphs, groups\n* introducing FBP/dataflow in existing system\n* encapsulation\n* error handling\n* testing, verification. TDD/BDD, static analysis\n* debugging. Breakpoints map to data breakpoints.\n* problem decomposition\n* general vs. specialized solutions\n* managing changes in requirements\n\n\n## Introducing FBP in existing system\n\n### Extending versus embedding.*\nTwo common approaches to gradually introducing FBP in a codebase\n\n1) Use it for the topmost architecture level.\nSo there might be like ~5 components, each calling out to a large amount of imperative codes.\nOver time one can 'grow downwards', moving each below layer into FBP components/graphs.\n\n2) Introduce in a particular sub-system\nIdentify a particular area which would benefit a lot from being FBPized, turn that into components+graphs.\nUse programmatic API of the FBP runtime to push data in/out of this as if it was standard imperative code (embedding).\n\nEasiest for code which already has a notion of independent 'components', with specific input and output data.\n\n### Components as wrappers\n\nIt can be beneficial to have the FBP components be a thin wrapper around imperative functions/classes.\nThis way one can reduce the changes required to existing imperative code,\nand the functionality can be still be accessed directly (without going through a FBP component).\n\n### Lifetime of FBP network(s)\n\nWhen embedding an FBP runtime, and running it from imperative code one needs to consider\nwhen to start/stop the network(s).\n\nFor instance in an HTTP service, a FBP network could be started/stopped with the server,\nand all requests are processed in the same network instance.\nAlternatively, one could create/start/stop a FBP network for every request.\n\nA short lived network can make it easier to provide isolation;\nguarantee that multiple invocations (possibly concurrent) do not influence eachother.\nOn the other hand, it becomes impossible to express (in FBP) how different invokation\nshould/do influence eachother.\n\nMost FBP tools are geared towards long-lived networks.\nDepending on the startup costs of the network,\nshort-lived networks might also have negative performance impact.\n\n\nHow to create\n===============\nCommon things that people build\n\n* protocols\n* parsers\n* plugin systems\n* state machines\n* user interfaces\n* web services\n\nBook creation process\n=====================\n\nIDEA: run a book sprint\n\n* invite a selection of experienced dataflow/FBP practicioners\n* invite an experienced booksprint person\n* sit together for 3-7 days\n* write the book from start to end, publish before leaving\n\nIDEA: use [Stack Overflow](stackoverflow.com)?\n\n* put questions/answers up\n* consider the book a curated \u0026 editorialized version\n* scripts for syncing the\n* use SO comments etc to handle errata\n\nCode examples\n\n* should be small program snippets, comparing imperative code and FBP code\n* should exist as a full runnable piece of code somewhere\n* FBP graph must be rendered to image. Maybe using https://github.com/the-grid/the-graph\n* imperative code must be syntax highlighted\n\nIDEA: verify code examples using tests\n\n* challenge: need to verify both imperative and FBP version\n* maybe use https://github.com/flowbased/fbp-spec or variation?\n\nIDEA: consider building a reference / \"cheat sheet\"\n\n* Two-way mapping between concepts/patterns in imperative and FBP\n* Must be searchable\n* Should fit on couple of pages\n* Should potentially be cross-linked, because same 1 concept/pattern\non one side may map to many concept on other\n\nReferences\n===========\n\nLiterature\n\n* J. Paul Morrison: Flow-based programming\n* Matt Charki: Dataflow \u0026 Reactive programming\n* Paul Tarvydas whitepapers on bmFBP etc, https://bittarvydas.wordpress.com/\nTODO: put whitepapers up online\nTODO: verify link\n* http://scriptogr.am/alfredo\n* http://expressionflow.com/\n\nHelp/docs for particular dataflow software (could extract general lessons)\n\n* [Pure Data](https://puredata.info/docs/BooksAboutPd/), Max MSP\n* LabView\n* Blender, Nuke\n* Native Instruments\n* [NoFlo](http://stackoverflow.com/questions/tagged/noflo)\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Fthinking-flowbased","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowbased%2Fthinking-flowbased","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Fthinking-flowbased/lists"}