lukaszmakuch / Rosmaro
Licence: mit
Visual automata-based programming in functional JavaScript
Stars: ✭ 176
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Rosmaro
Finity
A finite state machine library for Node.js and the browser with a friendly configuration DSL.
Stars: ✭ 88 (-50%)
Mutual labels: state-machine, fsm
Qpn
QP-nano real-time embedded framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
Stars: ✭ 107 (-39.2%)
Mutual labels: state-machine, fsm
Stately.js
Stately.js is a JavaScript based finite-state machine (FSM) engine for Node.js and the browser.
Stars: ✭ 785 (+346.02%)
Mutual labels: state-machine, fsm
Statemachine
A feature-rich, yet simple finite state machine (FSM) implementation in C
Stars: ✭ 168 (-4.55%)
Mutual labels: state-machine, fsm
Diagram Maker
A library to display an interactive editor for any graph-like data.
Stars: ✭ 2,086 (+1085.23%)
Mutual labels: graph, state-machine
fea state machines
A Buffet Of C++17 State Machines
Stars: ✭ 19 (-89.2%)
Mutual labels: fsm, state-machine
Hfsm2
High-Performance Hierarchical Finite State Machine Framework
Stars: ✭ 134 (-23.86%)
Mutual labels: state-machine, fsm
Squirrel
squirrel-foundation is a State Machine library, which provided a lightweight, easy use, type safe and programmable state machine implementation for Java.
Stars: ✭ 1,789 (+916.48%)
Mutual labels: state-machine, fsm
Fsm As Promised
A finite state machine library using ES6 promises
Stars: ✭ 446 (+153.41%)
Mutual labels: state-machine, fsm
Statecharts.github.io
There is no state but what we make. Feel free to pitch in.
Stars: ✭ 265 (+50.57%)
Mutual labels: state-machine, fsm
nodify
High performance and modular controls for node-based editors designed for data-binding and MVVM.
Stars: ✭ 282 (+60.23%)
Mutual labels: state-machine, graph
Ws Machine
WS-Machine is a websocket finite state machine for client websocket connections (Go)
Stars: ✭ 110 (-37.5%)
Mutual labels: state-machine, fsm
xstate-cpp-generator
C++ State Machine generator for Xstate
Stars: ✭ 33 (-81.25%)
Mutual labels: fsm, state-machine
qm
QM model-based design tool and code generator based on UML state machines
Stars: ✭ 54 (-69.32%)
Mutual labels: fsm, state-machine
Qpcpp
QP/C++ real-time embedded framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
Stars: ✭ 124 (-29.55%)
Mutual labels: state-machine, fsm
Django Fsm
Django friendly finite state machine support
Stars: ✭ 1,898 (+978.41%)
Mutual labels: state-machine, fsm
Rosmaro
Reacting to the same action in different ways due to what happened in the past may be a challenge.
Rosmaro is a framework for writing functions like this:
({state, action}) => ({state, result})
Check out the Rosmaro documentation at rosmaro.js.org!
Get Rosmaro using npm: npm i rosmaro
.
Rosmaro places great emphasis on two programming paradigms:
- Visual programming - changes of behavior are drawn using the Rosmaro visual editor.
- Functional programming - the whole model is a pure function built out of pure functions and pure data.
First, you draw a graph. Then, you assign functional code to its nodes.
It gives you:
- Automata-based dispatch - actions are dispatched to handlers based on the current node of the state machine. There's no need to check the current state.
- The right model for the job - the behavior-related state is expressed by a state machine, while the data-related state lives in a dictionary.
- Existing tooling - it's easy to use with redux and redux-saga.
Rosmaro models support:
- Node multiplication - a node may be multiplied using a function of the context.
- Reuse and composition - models may be included within other models.
- Lenses - thanks to Ramda lenses the shape and size of your data-related state may be easily adjusted.
- Orthogonal regions - multiple regions may be active at the same time. One of the ways to avoid state explosion.
- Subgraphs - nodes of state machines may contain other state machines.
News
An example
-
Use the Rosmaro visual editor to draw a state machine.
-
Write some functional code.
This example makes use of the rosmaro-binding-utils package.
const Frog = handler({
INTRODUCE_YOURSELF: () => "Ribbit! Ribbit!",
});
const Prince = handler({
INTRODUCE_YOURSELF: () => "I am The Prince of Rosmaro!",
EAT: ({action}) => action.dish === 'pizza' ? {arrow: 'ate a pizza'} : undefined
});
- Enjoy your
({state, action}) => ({state, result})
function!
[
{type: 'INTRODUCE_YOURSELF'}, // 'I am The Prince of Rosmaro!'
{type: 'EAT', dish: 'yakisoba'}, // undefined
{type: 'INTRODUCE_YOURSELF'}, // 'I am The Prince of Rosmaro!'
{type: 'EAT', dish: 'pizza'}, // undefined
{type: 'INTRODUCE_YOURSELF'} // 'Ribbit! Ribbit!'
].forEach(action => console.log(
({state} = model({state, action})).result.data
));
The complete code of this example can be found on GitHub.
Documentation
Blog posts
- A JavaScript framework for functions of state and action
- What did we lose when we moved to Redux?
- Dynamic orthogonal regions in state machines
- Decomposing the TodoMVC app with state diagrams
- An overview of the Rosmaro-TodoMVC app codebase
- Testing the TodoMVC app
- State management in JavaScript: data-related state and behavior-related state
Examples
- Bunny App a wizard implemented in Rosmaro, React, Redux and Redux-Saga.
- TodoMVC the famous TodoMVC demo app
- bool-less-todo a todo app implemented without boolean values and without variables
Utilities
- rosmaro-snabbdom-starter - a zero configuration Rosmaro Snabbdom starter.
- rosmaro-redux - connects Rosmaro, Redux and Redux-Saga.
- rosmaro-react - connects Rosmaro and React.
- rosmaro-binding-utils - makes writing simple Rosmaro handlers easier.
- rosmaro-tools - CLI tooling for Rosmaro.
- rosmaro-testing-library - testing utilities for Rosmaro.
License
Rosmaro is licensed under the MIT license.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].