Algorithmic programming

69 views
Skip to first unread message

Anand Tamariya

unread,
Oct 5, 2020, 4:14:44 AM10/5/20
to Flow Based Programming

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;


Paul Morrison

unread,
Oct 6, 2020, 10:11:23 AM10/6/20
to Flow Based Programming
Sorry, Anand, I'm not sure what you are trying to do here...  If it's a free-form notation for FBP networks, how is this better than Wayne Stevens' original notation, used by CppFBP, and also by NoFlo (FBP-inspired, rather than FBP)? 

Also, I don't see any port names, so it looks like you basically just have one-stream-in, one-stream-out components - unless I'm missing something...

If this is an enhancement to the basic FBP concept, could you spell it out more clearly?

Thanks,

Paul M.

Anand Tamariya

unread,
Oct 6, 2020, 12:11:54 PM10/6/20
to flow-based-...@googlegroups.com
Hi Paul,
My notation has following advantage in comparison to CppFBP notation as explained here https://jpaulm.github.io/fbp/CppFBP.shtml#netspec
'data.fil'->OPT Reader(THFILERD) OUT -> IN Selector(THSPLIT) MATCH -> ... ,
Selector NOMATCH ->
- Inline comment makes it very clear what's happening in that particular step. So one need not look into the component to understand the flow.
- It's easier to edit with or without a GUI tool. It's beginner friendly.
- You're right about One IP in and one IP out. If a component can't process an IP (not interested in that particular IP), it skips that. Hence no named ports.
- For business logic, this seems to be a good balance between complexity and maintainability. More complex idioms are better suited for a programming language which can be implemented within a component.
- Simple branching can be expressed as below

Component Judge decides to execute comp1 or comp2, Judge, comp1, comp2

Let me know if you see some obvious drawbacks.

Regards,
Anand


--
You received this message because you are subscribed to the Google Groups "Flow Based Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flow-based-progra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flow-based-programming/9b30a368-3cdc-400a-aac4-866d7d4270bfn%40googlegroups.com.

Paul Morrison

unread,
Oct 6, 2020, 4:56:13 PM10/6/20
to Flow Based Programming
Not sure why you call it "algorihmic programming" - surely, all programming is algorithmic at base...?

IMHO it is also not FBP - your comment about Judge says "decides to execute [a] or [b]", whereas, in FBP - specifically the CppFBP network you cite - Selector routes data to one process or another, concurrently...  And anyhow, your algorithm seems to work by having processes ignore some data, which presumably means that Judge has to mark the data it outputs in some way... And then comp1 executes, ignoring some of the data, followed by comp2, which ignores the rest...  

Actually, I'm probably misunderstanding your whole approach, due to my FBP orientation...  Maybe one of the other Group members can point out where I'm going wrong!   Also, some examples of using this technique on real-life applications would be helpful.

Cheers

Anand Tamariya

unread,
Oct 7, 2020, 12:19:34 AM10/7/20
to flow-based-...@googlegroups.com
When one starts on a program, one writes the algorithm as a sequence of steps. My approach maintains a one-to-one correspondence of the initial draft with the final program. The name kind of highlights that fact. Feel free to call it Anand's Programming or AP to differentiate it from traditional FBP in our discussion.

To test the feasibility of this approach, I wrote some code to generate the runtime/orchestrator (index.js) from FBP definition (init.fbp). The code is available here https://gitlab.com/atamariya/fbp .
You can run network.fbp (default) as
node index.js

You can also provide an FBP file without suffix as an argument
node index.js init

My components are not independent processes. They are simply pieces of code to be executed by the orchestrator. While components can mark the output data, in my branching example, it simply passes the input IP and executes the appropriate component. I don't have a conditional component yet as I haven't had the need so far. Maybe my components - split.js and parallel.js - come closest to your requirement of selector.

I'd be happy to answer should you have further queries.

Reply all
Reply to author
Forward
0 new messages