It's 2020 and we have a plethora of programming languages each
having it's own USP. For business programming, this means the business
logic has to be re-written using a new programming language every decade
to benefit from the advances. Few months back, I had started on a goal
of converting an algorithm to executable code with focus on easy
maintenance, code re-usability and language independence. I'm glad to
share an approach that might just work. Let me know if you find it useful or have some comments for improvement.
network.fbp (Sample FBP program)
Read line from network.fbp,lineReader,network.fbp
Parse nodes,parseNodes
Append nodes,append
Generate code,genCode
Execute code,vmscript
This is a simple CSV file with three mandatory fields:
- Comment explaining the step
- Identifier from a component implemented in a programming language
- Init parameters for the component
index.js (Sample NodeJS implementation)
var packages = ["lineReader", "parseNodes", "append", "genCode", "vmscript", ];
var vars = [];
var initargs = [];
initargs[0] = ["network.fbp"];
var core = require("./core")();
var res;
res = core.init(packages, initargs, vars);
res = res.then(() => core.execute(e));
res = res.then((e) => {
console.log(e);
// Additional code to process res
// Returned value is the value of res
return e;
});
return res;