Readit News logoReadit News
Posted by u/gabigrin a year ago
Show HN: Flyde – an open-source visual programming languagegithub.com/flydelabs/flyd...
Hi HN! I’m Gabriel, and I’m happy to share a project I’ve been working on for the last few years: Flyde, an open-source visual programming language. Check out the interactive examples and online playground on the website: https://www.flyde.dev.

In my last role as an engineering manager for a B2B-oriented product, I authored and reviewed many diagrams for backend applications, mostly for integrations between 2 third-party services. Some of these diagrams were elaborate enough that I started dreaming of a way to simply run a diagram as is; I imagined a “run” button on the top-right corner of the screen that would execute the diagram without the need to translate it into code.

That led me down a rabbit hole of exploration and experimentation, from tools like Zapier, Pipedream and Make, which are great for automating “backoffice” stuff, and up to NodeRED, NoFlo.js and the great work of J. Paul Morisson on Flow-Based Programming. I failed to find a tool that would answer my needs - a tool that balances a new level of abstraction, manages to stay powerful and flexible, and most importantly, integrates with the existing ecosystem, and doesn’t replace it. I built Flyde as an attempt to answer that need.

Flyde is designed to complement and enhance traditional textual coding, not to replace it. It includes a VSCode extension, it seamlessly integrates with existing TypeScript/JavaScript code and can run on Node.js and in the browser.

I believe that as we delegate more coding tasks to AI, we’ll assume the role of an architect rather than a programmer. This shift will require tools that focus more on orchestration and high-level troubleshooting and less on low-level functionality.

I’d love to hear your thoughts and feedback on Flyde’s direction!

pjerem · a year ago
That's really great.

I know it's polarizing but I truly think that visual programming remains an entirely unexplored area. I'm convinced that the current state of "text" programming is totally ineffective and in fact we are the last domain producing things with computers which still insist in being limited by the text files in folders abstraction.

It's a shame that in 2024, I still have to search for text in files like it's 1970, guess which file does what based on the dozen of characters of the file name and can't see at a glance which other files are dependencies or uses.

I can't "see" my entire codebase, zoom in and out, I still have to guess the relation between some line of code and another in another file.

My ideal IDE of the future just allows me to see all my codebase like a big fractale.

thesuperbigfrog · a year ago
>> visual programming remains an entirely unexplored area

Visual programming languages have been around since at least the 1970s:

https://en.wikipedia.org/wiki/Visual_programming_language

Several are used real-world production cases:

https://en.wikipedia.org/wiki/LabVIEW

https://en.wikipedia.org/wiki/Simulink

https://en.wikipedia.org/wiki/Pipeline_Pilot

https://en.wikipedia.org/wiki/IBM_Cognos_Analytics

While visual programming systems work better for some use cases, they are usually less agile versus text-based systems for several generalized programming tasks: 1) difference comparisons ("diffs"), 2) version control, 3) code search, and 4) code input (Most visual systems require a mouse and careful placement of connectors).

Visual programming systems tend to excel for domain-specific tasks carried out by non-technical or semi-technical users, but for generalized programming, text-based programming systems are more popular for highly technical software developers.

throwaway632 · a year ago
Another problem with visual programming is it forces your program to be planar, or at least nearly planar with some crossovers.

In my experience real code can't be represented legibly on a 2D plane. "Generate code map" features of IDEs usually produce incomprehensible graphs, when you try them on actual codebases.

I never tried CodeSee before it shut down, was it any better?

hermitcrab · a year ago
Text vs visual programming is a topic that comes round regularly. I've tried to write summary of why both have their place here:

https://successfulsoftware.net/2024/01/16/visual-vs-text-bas...

It agrees with quite a few of the points you make above.

spauldo · a year ago
There are also the three graphical PLC languages standardized by the IEC - Ladder, Function Block Diagram, and Sequenced Function Chart.

They're used everywhere - anywhere you see a shiny metal cabinet with conduit running in and out, there's a chance there's a PLC plugging away in there.

Ladder dates back to the 70s and I'm willing to bet is the most used graphical language in existence. It looks like the relay diagrams that electricians use.

analog31 · a year ago
I used LabVIEW for a couple of years. The big issue for me was ergonomics. Coding was physically laborious, and I went home with splitting eyestrain headaches. It occurred to me at the time that a dataflow programming language could support either text or graphical input, depending on the user's ergonomic preferences. I have the same problem with CAD.
int_19h · a year ago
If you count flowcharts (which one should, IMO), it has been around older than any text programming languages even.
catapart · a year ago
Hard agree. For me, it's the delegation of concerns that visual programming excels at.

I don't have to care how you're getting a random point in a sphere. Whatever algorithm you want to use works for me. And since you know which algorithms work better for which scenarios, you can put all of that delegation under the hood. All I have to know about is which node to use. And if something starts breaking, I know that it can't be my problem; it has to be a problem with the node's code and that domain professional can address it.

Of course, a good dev might say "That's just having a really good API", which is true! But once you have an API so good that you don't need to know any of its internals, you're essentially trying to write a graph using documents, which is kind of silly. High-level servers are a great example (node servers, python servers, etc). There's not any utility in writing an expressJs server with text that isn't satisfied by writing it as a flow chart. Servers, at that level of abstraction, are so simple that all you really need to do is tell which keys go where, when. And that's most simply done by drawing boxes and arrows that all point to each other.

Put more starkly: there's no difference between writing `Lib.Physics.GetPointInSphere(param1, param2, param3)` and linking a `GetPointInSphere` node to `param`s 1, 2, and 3. So I think that if you're in a domain that is already at that level of abstraction, visual programming is a fantastic way to go. And if you're not already at that level of abstraction, there's value in getting there (even though it's probably going to require fracturing/modularizing existing concepts).

javcasas · a year ago
I think lines of code in a text editor is a terrible way of describing state machines and flow diagrams.

And I think flow diagrams are a terrible way of describing many algorithms.

Flow diagrams look great for multi-processing pipelines and event suff.

I'm interested in this as an addition to current coding practices.

gabigrin · a year ago
100%! Cherry-picking what makes sense to "elevate" to the visual sphere and having it co-exist with traditional coding is the only way I believe visual programming can be truly useful.
ivanjermakov · a year ago
While I agree that text might not be the best way to represent a program, text files have many convenient properties that make them hard to replace:

- Simplicity: every computer and most humans can interptet it without any issues

- Diffing: it's relatively easy to tell what changed in a text file between revisions

- Editing tools: text editors, formatters, etc. exist and many people know how to use them efficiently

Also, modern developer setups allow you to manipulate code as a syntax tree (see tree-sitter text-objects) and intellisense and snipping tools allow you to type much less.

andoando · a year ago
This seems more like a matter of having more tooling because 99.999% of programming has been text based.

If we spent the time building tools for visual coding it’s possible we’d be able to do way more.

Just thinking about diffing for example, it would be much easier to see which nodes have changes in the whole codebase by just highlighting them red. It’d be easier also to depict something like “the flow for this process changes from this to this”

papa0101 · a year ago
I suppose it all depends on personality: some swe's prefer to write, some prefer to draw (I do both, but would hate to only have to deal a 1mil-lines-of-code fractal, but would be (and am) fine with the 1970 approach). The OP's solution then might be a great addition to my toolbox.
hakanderyal · a year ago
That's the outcome I'm hoping to get from all these VR/AR tech people are working on. I believe we have the hardware to make this work and someone just needs to build the software.
conartist6 · a year ago
Couldn't agree more, which is why I spent the last three years building the tech that gets us there -- a universal document object model for code! If you thought you'd be waiting 10 years for this tech, it's probably more like 2 now.
corytheboyd · a year ago
I was like WAIT that sounds REALLY familiar :D
aetherspawn · a year ago
Not really, most software in your car for example is written in the visual programming language Simulink, which IMO is leagues ahead of the concept of Flyde in layout and composability.

Simulink has been around and in heavy use for at least 2 decades but I think the $20k/yr price point is why we don’t see many other applications of it (even though people HAVE written games and web apps and such with it)

gabigrin · a year ago
Thanks! I agree, and while no one knows how development will look in 5-10 years from now, I find it hard to believe it'll be _just_ textual based, and I hope Flyde will help inspire that move.
divan · a year ago
I attempted to do this [1] and explored topic of why VPL are not a mainstream too, but postponed project for maturation of VR/AR ecosystem as I see them usable only in VR now. This year actually I think to return to work on it.

[1] Rethinking Visual Programming with Go - https://divan.dev/posts/visual_programming_go/

rsoto2 · a year ago
IDK i started using TouchDesigner and while it was cool...had to watch tons of tutorials before i was remotely effective, and once I figured out how to have it call a python script, everything was much more productive/simple.
tistoon · a year ago
I see it as comparing comic book (visual) vs text book (text code). You can express some visual better with comic books, but in the end, I find text books easier to define richer and complex matter.
esc861 · a year ago
What you are describing sounds a lot like C4: https://c4model.com/
taskforcegemini · a year ago
there's a lot of effort being put into hiding the file based systems underneath (i.e. "libraries" in MacOS, mobiles OSes like android). if something doesn't work or data is lost, it takes people who know what files are, to fix things. Please don't take files away from us, we just want to be able to help.
d--b · a year ago
I will tell you the same thing I tell everyone making visual graphs like this:

PLEASE PLEASE PLEASE PLEASE PLEASE make the nodes snap to a larger grid, and have the grid browsable with the keyboard.

I'd rather use Factorio as an interface than an interface where the nodes and edges just float around.

Excel is a DAG that is browsable with the keyboard (Ctrl+[ anyone?), and that's proven very usable.

culopatin · a year ago
And I rather have the boxes stay where I put them and make a mess of the lines than have the lines be all clean but every time I add a condition all the boxes reshuffle like ServiceNow does in their visual low code programming stuff
catapart · a year ago
- This looks great! Very robust and I really like the focus on interoperability.

- As a general design, I prefer the integrated "function with parameters" node type found in systems like Unreal's "Blueprints" far better than having to manage the parameters and functions separately from each other. It's more cumbersome to develop, but no less flexible to use, and loads more simplified. A distinction for the code flow from the data referencing is helpful for me, at least.

- It doesn't fit my exact needs, because I need something that allows me to expose this functionality to users. Essentially, I need something that does what your playground does, as a library. The interoperability is perfect, though! Allowing users to set up flows and then being able to simply import them rather than having to translate them is a fantastic DX. I guess, at the end of the day, I would still like clean, nicely formatted Javascript (not typescript), so I imagine your library isn't really suited for that, either. But I definitely like the architecture of it!

gabigrin · a year ago
- Thanks! - Re: "function with parameters" you mean so the configuration is exposed on the node itself? It's definitely something I want to consider as an UX improvement. At first, I was very puristic about having all configurations acceptable as dynamic inputs, to ensure Flyde is robust and flexible, but that led to things like the HTTP node having 5 different pins which made it even worse. Now it's a hybrid model - as an author of a node you can choose how to expose it, and many nodes in the Stdlib expose configuration in both ways - Interesting use-case! Flyde's last incarnation was an attempt to offer this to other SaaS products (before realizing it must start OS) to allow their users to do "Visual scripting" (like https://luna-park.app/, a project I've stumbled upon) You can check the source code of the playground and try embedding Flyde, should work!
Herobrine2084 · a year ago
Hey, author of https://luna-park.app here! (I was wondering where the spike in visits came from ^^'... Thanks a lot for mentioning me!).

Luna Park was indeed a npm package that you could integrate to allow users to build their own logic using visual scripting. In the end, I pivoted, and Luna Park is now a visual scripting wrapper around the Vue.js framework, allowing people to build modern webapps without code. (I also made https://roller-coaster.app to create endpoints using the visual scripting system of Luna Park)

In any case, that's super cool to see people building awesome tools like yours in the visual programming space :) ! I love how Flyde show you what node is running, and the way it executes logic is really interesting!

catapart · a year ago
Yeah, that's part of what I'm talking about, for sure. Being able to, say, click a little expand icon to see other pins that aren't usually necessary, is great for discoverability. I'm not a big fan of library maintainers deciding that I can only use certain inputs for an underlying function that I know has more functionality. Node authors should, of course, be able to guide, but I don't appreciate them having the ability to control.

More than that, though, it's about the difference between 'data references' and 'execution flow'. It's something that Unreal makes very, VERY obvious. Color coding data types, emphasizing execution flow lines, etc. I can't recommend using it as a guide, enough. Whatever problem I've come up with as 'complicated' for visual scripting, they've got an elegant solution for.

Even stuff like being able to 'break' nodes into other nodes, or pins into other pins. So a "Point" node might be useful for sending into a function expecting a Point data type, but you might also want to send just that Point's x or y value to something else. In that scenario, you might 'break' the exit pins into a Point reference, an x reference, and a y reference. It would be cumbersome and unruly to always have that available. But the UX to make it available is straightforward and satisfying.

And then, all of that aside, I just prefer the visual look of pins integrated into the nodes. The extra lines you get from drawing between the pin and the node is messy and since you can't move them independently, they don't really add anything. Just a lot of extra buffer to prevent a 'crowded' feeling. But at least that's not something unique to Unreal. I don't think I've ever seen a visual scripting system that used pins as separate elements. So maybe it's just saturation bias. But I do like what I like!

Anyway, I'll definitely mess around with it and see if it can help with its embedded version. To be completely honest, I think there's too much friction, overall. I would need something to render as plain javascript, rather than a JSON structure or minified JS (or typescript), so there's a translation there. And then to get it graphically how I want it would be complicated due to all the domain-knowledge required for integrating with your app's underlying library (looks like next js? Not sure, but it's not something I want to work with). Not to be too pessimistic or anything. Most libraries work toward providing a complete solution, not towards providing a composable, compsitable, modular set of utilities, which is what I need. I don't hold any contempt for providing what you've provided because it's a hell of a thing and perfect for a lot of use cases, I'm sure! I'm just very pragmatic about my own use-cases, and my development quirks (like not using libraries that obfuscate functionality [next, react, svelte, etc]).

lominming · a year ago
Great to see more people thinking about this space. Totally agree on the sentiment that we should be able to visualize/describe and build business logic in a very simple manner. The way I've been thinking about this is something like Legos where we can compose any logic, app, workflow we want visually and that anyone can build and share these blocks. This is almost similar to NPM packages, but for non-developers.

My attempt on this is https://openexus.com where the goal is really to create some form of universal plug-and-play building blocks. Your approach is almost very low-level with direct translation to code. My attempt is slightly higher-level (but developers can create as low level as they want). More importantly, the visual diagram build on openexus is a reactive graph (almost like spreadsheet), not a sequential directional flow graph (like node-red, or yahoo pipes).

Would love to chat if you are up for it. m at lominming dot com.

gabigrin · a year ago
Open Nexus looks great! The UI design is super clean, and the open-ness of your nodes give it true Bret-Victor-ish vibes!

I started closer to this at first (but still lower-level) and slowly got "down to earth", taking a https://www.dreamsongs.com/WorseIsBetter.html approach.

westoncb · a year ago
This looks super nice :) love it
couchand · a year ago
Congrats on the show HN! It looks like you've put a lot of thought and effort into this, and reasearched a number of alternatives.

I'm curious to know more of what you found lacking in the various visual programming languages? You mention a few general things but (other than the integration angle) I'm having a hard time understanding exactly what limits you hit with the other options that caused you to build your own.

And to add some context to the above questions, is this primarily your own research or do you anticipate it being used for production systems?

gabigrin · a year ago
Thank you! Flyde's first incarnation was more of a "Visual serverless" platform, something like Zapier, but where you could "see the JSON" and change any piece you want. So the alternatives at that time were NodeRED, n8n and NoFlo.js. I think NodeRED and n8n are both successful products with their own niche, but I was looking for something more flexible. At the time, I was trying to build something very robust, flexible, and generic, that could also be used to build UIs with (see this cumbersome, but working example https://play.flyde.dev/apps/974a3913-1b3b-4a0a-9ca7-4e2a69d0... ) a lower-level visual language that will match the functional-reactive paradigm I was used to code with, and not something too structured. I wanted it to be able to do most things I can do with code, and cater to application-layer developers.

NoFlo.js was the closest to allowing this, but I think that it was too early for the game, and NoFlo took a non-integrative approach. Vladimir Sibirov wrote vastly about that and why he thinks it failed in this great blog post - https://blog.kodigy.com/post/state-of-flow-based-programming... I was happy to see Flyde addressed this

Other purely FBP implementations did not put enough emphasis on the visual aspect, which for me was crucial to nail on a holistic level.

And for your last question - my goal is for it to be used in production systems, yes. I plan to release a Flyde-based visual API builder soon - https://www.trigg.dev as a more specific use-case, and hope that the fact you can download the Flyde flows and run them wherever you want will help potential users overcome the fear of using a low-code tool.

ilaksh · a year ago
I mean, NodeRED can be used to build front ends with Dashboard 2.0 or UI-buikder or custom nodes.

Is your project really better than NodeRED? I mean it does have over 4000 community contributed nodes.

s_gourichon · a year ago
> visual programming

25 years ago when I read that Microsoft has a software development environment named "Visual Studio" I imagined, well, something with graphs and nodes and flow and... Well something visual, right? Now it's 2024 and VS is still not visual.

Of course things are not as simple. Flyde (along with many alternatives mentioned) is visual IMHO. Keep up the good work!

int_19h · a year ago
"Visual" in Visual Studio was a reference to RAD. Basically, visual form and report designers.
gabigrin · a year ago
Thank you!
snadal · a year ago
Nice work, congrats!

I do love visual programming and I use n8n a lot for my side projects. I really like its "delayed debug" features, so that I can analyse each step of the flow weeks later than it happened (i.e, I can see why a webhook failed long ago and even replay it step by step).

One missing feature that I've been working on is a "export workflow to code" feature. This way, once you are finished working on a workflow, you could run it everywhere without the need of installing the full IDE.

Again, nice work!

gabigrin · a year ago
Thanks! Flyde is "just" a library behind the scenes, so you grab your .flyde file, and can run it with an npm package. For example:

``` import { loadFlow } from "@flyde/runtime";

const execute = await loadFlow("./celsius-to-fahrenheit.flyde");

const inputs = { celsius: 0 }; // "celcius" is a main input in the flow, therefore it must be provided when executing the flow const { result } = execute(inputs); // execute returns a "result" promise, along with a cleanup function that can be used to cancel the execution.

const { fahrenheit } = await result; // each output in the flow is a property on the result object

console.log(fahrenheit) ```

(taken from https://www.flyde.dev/docs/integrate-flows/)

But your comment strengthens my feeling that making this more intuitive and discoverable and is indeed something I should prioritize

snadal · a year ago
Nice! I definitely will try it :)
CyberDildonics · a year ago
I think approaches like this can be good for people learning programming for the first time, but there are two huge aspects that mean it is unlikely to be used for anything serious.

1. A new language. New languages don't go anywhere 99.9% of the time and when they do it takes a massive undertaking by hundreds of people as well as very careful design over the course of decades.

2. Building visually at the expression level. Writing expressions in any modern language is very compact. In this case what takes up a single line now takes up and entire screen.

if(n>1) return fib(n-1) + fib(n-2);

Graphs are much better for working at a high level because that's where the locality isn't there are it isn't clear what data is going where. For expressions drawing lines instead of just using the same variable that was used in the previous line doesn't help clarity.

andoando · a year ago
This is easily solved by having nodes which serve as a collection of nodes
CyberDildonics · a year ago
That's basically a function, and it might work out if one typical line didn't end up taking up so much space. Expressions still end up more clear and more condensed by such a huge margin it makes nodes look silly in general cases. Houdini is able to make it work but it's all data flow, there are no branches or loops.

This gets in to another problem I didn't mention - branches and loops (not to mention class declarations).

Feeding a function result into another function argument is great, but that was never difficult for expressions anyway. Once you get into branches and loops you have another problem that is a huge problem for nodes.

Ultimately programs don't map to data flow nodes, they are imperative. Certain parts of certain programs will end up mapping very well, but when looking for silver bullets in something that isn't 1:1, you end up hacking it up and forcing a square peg in a round hole to make the dream work.

WillAdams · a year ago
But that then creates the problem of lowering expressivity.

GraphSCAD addressed that by allowing functions to have custom icons.

I'd really like to see that become more prevalent.