I'd love it if someone found a solution to that, but it feels like an intractable problem beyond some specific use cases as you say.
I really hope I'm wrong.
I'd love it if someone found a solution to that, but it feels like an intractable problem beyond some specific use cases as you say.
I really hope I'm wrong.
Support for embedding such things in another language (Like we do with SQL and regular expressions) would be important, too.
That might be a place to start. Can we replace regular expressions with a visual language? What would it take to have “railroad diagrams” widely available in at least one programming language and many editors?
Consider how hard it is to even get people to use additional symbols, like the APL's do...
Along with markdown, there’s also increasing support for math equations in forums and blogging software.
Math symbols are a better example, but also extremely well established, and it's still taken a very long time to get widespread support, and it's still far from universal.
But note that non-ASCII symbols etc. was an example of the difficulty of even getting support for something "that simple". Now try to take the step up to e.g a node-based editor.
In practice every attempt I've looked at either become hard to communicate about the code in, or the visual aspect tends to end up just becoming a secondary visualisation of code that you still treat as textual first.
In the latter case, turning it into a better UI is an unsolved problem, because round tripping reliably between something readable as text and a meaningful visual representation is really hard.
As I said, I hope someone solves this, but most attempts aren't even pushing the boundaries into uncharted territory - a lot of attempts have been made over the years.
This also makes it easier to verify that you have all the same capabilities in both representations, as the ways of manipulating the AST are enumerable.
I built a language and UI around that way back, and many others have. I ditched mine because there were way too many unsolved problems I felt made it useless.
The problem is that if your primary means of working with the code is visual, the textual representation of your code then tends to be foreign to you when you're trying to use it to communicate aspects of the code, and when you constrain yourself to something that can be represented in a readable manner in a textual form, it turns out to be really hard to get to a point where the visual form is easier to work with.
E.g. something as basic as how you comment code in ways that roundtrips nicely is an unsolved problem.
If I have code represented as a graph, I'd be inclined to want to label relationships and dataflows that would be hard to place textually in a way that is meaningful in a textual version and that would roundtrip back to labels in the right place in the visual version.
I've not seen any attempts at visual code that gets even that right.
I've not managed to get it right myself either. If you force users to use an editor built into this tool, and edit a textual representation where some information is hidden, you can do better, but then if people e.g. copy a textual representation of the code into another application and back in, you end up with a mess.
Again, I want to be proven wrong about this. Badly. I love the idea. I've just seen enough failed attempts (and made enough failed attempts) to be disillusioned about it.
Commenting needs to be solved at the language level, and there are many languages that have solved this exact problem. Python, newLISP, and Smalltalk IIRC all have methods for docstring commenting APIs such that the docstring is available as text to the running program / REPL. Use similar syntax to allow any statement to have comments attached, and use this instead of free-form /* */ comments.
How would I communicate about the project to others in e-mails, instant messenger, face to face, in blog posts, in articles, in books?
How would I review diffs of code changes effectively?
That is why.
Find me a representation I can talk about and write about efficiently without screenshots or videos or requiring special software of every recipient on every platform, and you'll have advanced the state of the art in this field immensely.
> that have solved this exact problem
None of the ones you described have solved the problem of mapping between a visual and textual representation of the program seamlessly. Just attaching the comments from a textual version to an AST of the textual version is trivial. That's not the challenge.
> Use similar syntax to allow any statement to have comments attached, and use this instead of free-form /* / comments.
That doesn't get close to solving the issue. When I have a diagram showing the data flow of a piece of code, and I attach a comment to the edge* between the two nodes, in the textual representation where does that comment go? Does it go in the text version of the source node? In the destination node? What if I write a comment in the textual version right before a method call, and then switch to the visual version, does that stay in the source node? Does it become a label of the edge representing the method call? There are tons of edge cases there.
The problem isn't finding a way to attach the comments in the right place, but finding a way that roundtrips perfectly without adding noise in either representation.
I've not used a visual programming language and unit is (currently) hugged to death. But, my experience with graphviz's dot syntax would suggest putting a comment on the (textual) line that represents the edge itself:
digraph whatever {
running [ shape = "triangle" label = "program running" ]; # comment on the node itself
stopped;
running -> stopped; # comment about the edge
stopped -> running;
}
I acknowledge, though, that I'm thinking of this as a dsp-style situation, where a node only connects at its boundaries, rather than in the center (say if a node contains code that would link to another as part of an if expression's body).(Also, I'm disappointed that I need to resist the urge to talk about Bob Nystom's visual pdf diff, because it seems really cool but is not as credible as the edge directive above. https://journal.stuffwithstuff.com/2021/07/29/640-pages-in-1... , scroll to 3/4 where it says "Here is what all of the proofreading changes look like:")
I think that might well be one of those restricted situations where visual programming often works well enough that it seems some use. I'm absolutely not saying it can't ever work.
My problem with it is more when you try to do more general-purpose things with it, and you e.g. either end up with a node per method/function call (and maybe then even nodes for argument expressions) or large, complex nodes with internal logic.
I love dot for graphs, but the challenge to me with that approach is that I've not seen a convincing example where you'd then not end up with a mountain of text for even very simple things (and I've sinned badly there myself - one of my own early attempts serialised to XML...) when you decompose the text enough that you can augment it reliably.
E.g. consider a complex expression where that edge is not just a simple state transition, but a method call with arguments, where each argument itself might be a complex expression...
Every attempt I made myself ended up with a textual version that was too verbose to feel viable for communication about the code unless I stripped out so much that the visual tooling effectively became a tool to analyse the textual version, rather than allowing editing on equal footing.
https://youtu.be/70PH5cQQEdQ?si=y4YmhnimzferVpCD
Since you develop inside vr you can also talk about and show the code in the same vr environment.
It's probably at this level we need to rethink stuff to make visual programming practical.
You could for example explain every node verbally and visually to an AI bot that can then explain it to the next person, or selectively retrieve parts of your explanations on demand. (OK, I realize that sounds unnecessary complex.)
It's possible for a visual programming system to work without it, but it will need to be accordingly a far bigger step up.
Consider searchability on e.g. Stack overflow for example. If people don't have a consistent, shared vocabulary, just lack of searchable exposure is likely to forever condemning it to a niche.
>likely to forever condemning it to a niche.
The context within which we build visual programming languages needs to change in order for it to stop being a niche. As you point out, the alternative is [much] harder [today]. But I think that VR, as an example, will be forced to solve a lot of difficult UX problems if VR is to progress beyond a niche. And once those problems have found satisfying solutions the context for building nice visual programming languages will likely also have improved significantly.
(EDIT: And specifically to the sentence you cut that out from: For it to appear in search results, and so be discoverable* it still needs to be in a form that search engines know how to index)
There's nothing technically preventing us from having all our software allowing the embedding of visual code elements that can be manipulated via components - the technology to do that is decades old.
The problem is a combination of social, inertia, and the chicken and egg problem of there not being any sufficiently compelling visual programming system creating a significant reason to push for this.
I don't want to discourage people from trying. By all means, try - I'd love to be proven wrong, and I think you might very well discover something useful or learn worthwhile lessons from trying to push the limits of this. There are just lots of pitfalls to address.
E.g this is a real line of code:
link = wf["links"].find{ _1["rel"] == "self" && _1["type"] == "application/activity+json" }
Now consider I have a visual programming version representing that expression, and I want to ask someones opinion about it on Slack. Unless your visual programming environment has a solution for how I can post that to Slack, and have others respond with tweaked versions, it's a non-starter.Once you've solved Slack - maybe with a plugin -, you need to solve all our e-mail clients, and you need to solve Google Docs and Word for when we write documentation, and a multitude of other tools.
You might be able to get part of the way there with a browser plugin, but you'll still have a wide variety of other tools and platforms to cover.
I think you're right that the end game of any successful attempt at standardization is integration with all those tools like Outlook, Slack, Discord, Signal, Word, Docs, Notion... The list goes on and on. It's strange how the presence or absence of political momentum behind a standard could change that from being "basically impossible" to "basically inevitable"
On the contrary you will find that throughout this thread my biggest issue with visual programming is the reverse:
That a textual syntax that maps cleanly to the visual representation is an absolute necessity.
The problem is no visual programming system has included such a system. They've either been only visual, or they've been visual representations of programs written in classical programming languages.
Nobody has come up with, e.g. a language designed specifically to facilitate new visual programming capabilities without losing the ability to cleanly roundtrip to text.
I tried and gave up. Maybe I'll revisit it again in retirement, but I really hope someone beats me to it and finds something that works.
I grant that this makes the project significantly larger if you're going to remove that constraint.
Open up the source code for this web page: is it compact and readable? The answer seems to be that HTML is "good enough" in that regard, and I suspect CSTML will be the same especially as more developer tooling for it becomes available.
To take your example, pretty much anything longer than [1, true, "3"] is a non-starter if someone is pasting it into Slack, or sending an e-mail. The CSTML representation isn't readable to them, and would take additional steps on both sides vs. just writing the source representation. I'm not going to tell people how to do something by writing it into some other tool and pasting some large blob into Slack or my e-mail client and expect the recipient to reverse the process.
That is the problem space. How you represent that as an AST isn't the problem - that's easy. How you represent it in a way that everyone can read and write and that "passes seamlessly" via existing tools is the problem.
(I must also admit that I think the choice of serialization format for CSTML is utterly baffling and feels like it adds a lot of NIH)
Try copy and pasting some HTML-formatted text from this page into your paste buffer.
I assure you that what goes into the buffer is HTML. You can verify this because if you paste the text into an HTML-embedding WYSIWYG editor (such as an HTML email composer) the formatting will be preserved. But if you paste the content of the same HTML buffer into VSCode, notice that you don't get the raw HTML but rather the textual content that was embedded in that HTML.
Now try doing the same with CSTML, in applications that so support HTML.
Now consider how little that markup contributed to the semantics of the text here - most of it can be stripped and the text retains it's meaning.
Then consider how long it took for HTML to percolate through these applications despite HTML - unlike CSTML- having universal utility.
And here's the thing: As someone with a history of writing compilers, parsers, language tools over 30+ years, CSTML is too verbose for me to want to use even for tooling. It's way too low level even as an internal representation for tooling.
It also still doesn't help: You still will need a compact textual representation anyway so people can represent it in contexts where the tooling doesn't exist, or can't exist, such as paper and handwriting, and speech.
All I can do is encourage you to try. If you succeed, great, and if not you will understand the difficulties involved.
I've tried the custom syntax representation (though I used XML which saved me from writing a custom parser) - it turned out to just be an obnoxious detour. I tried syntax aimed at removing ambiguity in round-trips, and it sort of worked but got too verbose. I tried a purely visual approach, and hence why I'm so insistent you need to be able to roundtrip to text. I spent years trying things and looking at others attempts.
I'd love to be wrong, but I very much don't expect any big breakthroughs in this area in decades - the attempts I keep seeing keep repeating all the same mistakes with few signs of lessons learned.