Email or username:

Password:

Forgot your password?
Niki Tonsky

Diagrams are indispensable. I really wish we had a way to put them directly into source code (or rather _use them as source code_), not as a side artifact blog.sbensu.com/posts/demand-f

22 comments
Steve Purcell

@nikitonsky where do you feel the Glamorous Toolkit ("moldable development") approach fits in this aspirational world-view? (Pervasive examples and visualisation in the course of regular development.)

Niki Tonsky

@mkvlr sure but it’s still one-way. You can embed diagrams into code, and I imagine you can even analyze your own code and display results as diagram.

What I want is seeing e.g. state machine diagram like this, drag some nodes and it actually affects the code.

Like, if something could be expressed better via diagram, you do it directly via diagram, without going through code at all

Martin Kavalar

@nikitonsky understood and very much onboard that for some situations direct manipulation is more effective than editing code.

Mario Trost

@nikitonsky @mkvlr Do you know stately.ai/editor?

Powerful stuff, alas only for Javascript. It lets you go from code to diagram or from diagram to code and not just for simple state machines, but full on statecharts

Raphael

@nikitonsky @mkvlr Jetbrains MPS seems to be able to do (read: enable you to build) things like that, if only "simple" visualizations. "Projectional editor" is what they call it, IIRC.

Nundrum

@nikitonsky I wish we could #sixel or otherwise put images inline with terminals. That might go a long way toward putting diagrams "in" with code.

But using the diagrams for input? At that point it's not just code anymore. There has to be some extra-special tooling to support it. Or a VM. I guess Smalltalk is able to do this. But it certainly changes the nature of code as we typically think of it now. The "side artifact" seems inescapable.

Though maybe something like org-mode fancied up so you could toggle between data representations and diagrams/widgets?

@nikitonsky I wish we could #sixel or otherwise put images inline with terminals. That might go a long way toward putting diagrams "in" with code.

But using the diagrams for input? At that point it's not just code anymore. There has to be some extra-special tooling to support it. Or a VM. I guess Smalltalk is able to do this. But it certainly changes the nature of code as we typically think of it now. The "side artifact" seems inescapable.

Niki Tonsky

@Nundrum if you want diagrams the first thing you want to get rid of is terminal. Why do people still try to make it into graphical environment?

Nundrum

@nikitonsky Because it's amazing.

What could replace the terminal? Something that tends toward a heavy-weight IDE.

Top-down or bottom-up? I don't know the right way to approach designing the solution, but I would like to see images embedded in terminals as a test.

dotemacs

@nikitonsky good article.

About adding the diagrams, nice idea.
Emacs can sort of do that via easydraw: github.com/misohena/el-easydra

It's a full blown diagram editor.
But I guess the down side is that it's not cross-editor supported.

shikanoko nokonoko

@nikitonsky Emacs can do this ootb!

It's called iimage-mode

Gleb Voropaev 🐍

@nikitonsky

Interesting. It’s pretty clear that in case of ‘level 3’ code must be able to declare dependency on diagrams in order to be able to use them.

But could diagrams be dependent on code too? For example, this feature could be useful for declaring handlers for processing state transitioning.

But I can’t wrap my head around how UI for editing such diagrams would look like 🫢

Niki Tonsky

@gvoropaev yes, dependencies both ways. Just think of a diagram as another module

Zaͩnͦsͤt̀́rͤa̅̆̈

@nikitonsky Nice writing about visual programming. One open door (since you also work on HumbleUI): I always liked the .nib-files (NeXTStep/Mac/iOS) as a way to draw your user interface visually. Now this has been replaced by SwiftUI. That's going the opposite direction. Or is it?

Niki Tonsky

@doekman never worked with them (that’s from interface builder, right?), so I can only guess.

Drawing your screen visually is fine until you have dynamic parts in it, I guess. If most of your UI is dynamic, drawing it must be painful. If most is static, then sure

Zaͩnͦsͤt̀́rͤa̅̆̈

@nikitonsky To be honest, I haven't used it extensively... I used some dynamic stuff like tab-bars, but I guess in more complex layouts there might be problems on the way…

Niki Tonsky

@PaniczGodek yes! This is exactly what I’m talking about

Panicz Maciej Godek

@nikitonsky you may want to check out some links from the second post pinned to my profile (the first one is also somewhat relevant)

Kris Mitka :java: :rust:

@nikitonsky TogetherJ did this in Java with comment annotations it was awesome. Generate your UML diagrams from your code as you go

Go Up