Code Appendix to a BP intro talk hosted by Devoxx.be 2018
Behavioral Programming is a programming/modeling paradigm, under which computer systems, which are often required to demonstrate complex behaviors, are composed of multiple simple threads of behavior.
Behavioral Programming was developed by David Harel, Assaf Marron, and Gera Weiss circa 2010. It is based on Scenario Based Programming, which was developed by Werner Damm, David Harel, and Rami Marelly (1999, 2001, 2003).
To use these files, you'll need Java, and the BPjs über jar available here.
To run:
java -jar BPjs-0.9.3.uber.jar {filename.js}
To verify:
java -jar BPjs-0.9.3.uber.jar --verify {filename.js}
To use several files at once, simply list them in the order you wish them evaluated. Use -
to read from stdin.
hello-world.js
: The file live-coded at the talk. Contains the four b-threads required to generate a proper "Hello Devoxx World" message.block-orders.js
: A set of b-threads that enforce, and test the enforcement of, the requirement:"when we run out of a products p1 and p2, do not allow new orders until the stock is renewed"
limit-consumption.js
: A set of b-threads that enforce, and test the enforcement of, the requirement:"Do not use more than
$LIMIT
resources at a time"page-cleaner.js
: A set of b-threads that enforce, and test the enforcement of, the requirement:"Every three pages, clean the ink jets"
The visual maze swing application can be found here.
- www.b-prog.org: Main BP site, including other BP frameworks (C++, Java, Erlang, Blockly)
- github.com/bthink-BGU: BPjs, projects presented in this talk
- bpjs.readthedocs.io: BPjs tutorial and reference
- groups.google.com/forum/#!forum/bpjs: BP Google group
- scenariotools.org Textual description language of Live Sequence Charts, Joel Greenyer
Also, there are many academic Papers (e.g. algorithms, event selections, visualizations). Search for "Behavioral Programming", "Live Sequence Charts (LSCs)", "Scenario Based Programming", or "Scenario Tools".