top | item 44006463

(no title)

concerndc1tizen | 9 months ago

I've been interested in this for years.

Are there other similar projects that you're familiar with? Perhaps targeting other languages?

What are the major problems with this approach to programming? Are large programs hard to work with?

discuss

order

Towaway69|9 months ago

I know of Py-Red[1] which is an attempt to do the same but with Python. Using Node-RED as a frontend and something else as a backend, no I haven't heard of anything similar.

Main problems with visual flow based programming is the tooling: there aren't any good tools for doing visual comparison nor visual version control. Things like GitHub aren't able to render flow code as seen in the editor.

For Node-RED that means that the Json that defines a flow can be compared but that soon becomes meaningless because semantic changes get mixed with visual changes, i.e., that the x,y coordinates of a node have changed - is meaningless for the logic of the code.

This means that code sharing and collaborative development is difficult purely visually but only because tooling is missing. Compared to textual programming before things like SourceForge or Git and we had the same issues as we do with visual coding now.

Node-RED has a bunch of features to make large programs maintainable. Things like link nodes that allow jumping between flows also allow code reuse. There also subflows which encapsulate repeated code and can be referenced from anywhere.

That's also why I chose Node-RED for this because it seems to be the most mature and best maintained low-code visual flow-based programming tool. There are others such as n8n (which seems to be the other biggie) but they lack the generalness of Node-RED. I can create web sites with Node-RED while and the same time controlling my LEDs via Raspberry installation. Node-RED is extremely flexible.

[1]: https://github.com/mdkrieg/py-red

applied_heat|9 months ago

For function block programming used in control systems in PLCs there are tools like copia.io that are basically GitHub for version control and can do visual diff of the diagrams

regularfry|9 months ago

Speaking of controlling LEDs, there's also https://www.atomvm.net/doc/main/index.html. From a very quick scan it looks like it would need some fiddling (especially around the filesystem) to get it to work, but being able to scale down to smaller devices than a full pi would be very, very interesting.

paddy_m|9 months ago

re:version control

How stable are node and edge IDs and their ordering? Could you sort the JSON before saving so the output is more stable and diff-able?

Another thought is, how would you code up a flow like this in your preferred language if you were just writing code in that language (you didn't care about the visual editting). Call most of the same functions, but do it directly. Ok, think about that, then write a transformation from the NODE language to output source in your preferred language.

I have some sense that coding this type of control flow logic doesn't work well with text line based diffs because of the complexity of the problem, less the syntax.

punnerud|9 months ago

One star on Gighub, could still be good though. Any alternatives on Python that is equally used.

HomeAssistant build on Python have an Node-Red extension, would be nice to see a Python version with more seamless integration

WillAdams|9 months ago

Well, there are pages on problems such as;

https://scriptsofanotherdimension.tumblr.com/

https://blueprintsfromhell.tumblr.com/

and the biggest problem is that a strong bound is screen/display size --- any code chunk which won't fit on a single screen becomes hard to follow (which direction does one scroll next?) and if one does the obvious of declaring modules, then one runs into the wall of text which one was presumably trying to escape from --- just each word is wrapped up in pretty boxes and decorated with lines.

My take on this has always been that we don't have an answer for the question:

>What does an algorithm look like?

That said, I work in this style when I can, often using:

https://www.blockscad3d.com/editor/

to rough out a design, or:

https://github.com/derkork/openscad-graph-editor

for more complex projects --- though that latter usually with a special-purpose library I've been working on: https://github.com/WillAdams/gcodepreview

paddy_m|9 months ago

This is related to visual programming, not flow based programming.

I modified a python hosted lisp interpreter to read JSON flavored lisp - JLISP. It's much easier to get a web frontend to output JSON then lisp. Then I made a simple Low Code UI built around this language. The editor has operations (invocations of lisp functions) organized left to right like a timeline in CAD software, then you can click on an individual operation to edit the arguments.

Here is a video walking through the system https://youtu.be/3Tf3lnuZcj8

Live edittable notebook (slow to load, runs python in WASM) https://marimo.io/p/@paddy-mullen/jlisp-in-buckaroo

I'll make a statically exported Jupyter notebook shortly

jayd16|9 months ago

Unreal Blueprint is probably the most popular. Its a custom system over a fairly customized C++ framework.

Visual scripting can be highly productive. The major issue is these visual scripts usually do not map cleanly back to text so you're throwing away decades of tooling. They usually don't merge well either.

randunel|9 months ago

I see there's some suggestions here, you may want to give nodescript.dev a go, it's also nodejs based.

As a disclaimer, I'm somewhat affiliated with the project.