News for hackers. Stuff that matters.
Re:How do you visualize code? by mr_tristan on Tuesday January 18, 2022 @03:56PM (#29985656)
I find that programming languages are themselves a great reference... for the logic of a single thread. The moment you start doing concurrent development, or hell, even basic event-driven code, it gets much harder to "just read along". This is where I would kill for visualizations to help out.

Like, if you fork your process at a point, vertically split the text into two columns with a line saying "new thread over here". And then highlight any points of synchronization.

I think when people think of visualizations, it's "everything is a 2D graphic". When really, there could be new ways to laying out and navigating text-based source.

Re:How do you visualize code? by oweiler on Tuesday January 18, 2022 @04:11PM (#29985881)
That would be awesome! Is there any IDE that does that?
Re:How do you visualize code? by hutzlibu on Tuesday January 18, 2022 @04:56PM (#29986551)
Not yet, as far as I am aware. And it is really a nontrivial problem to make something like this, that not just looks neat, but works efficient.

(I know this, because I am working on something like that, since quite a while)

Re:How do you visualize code? by mr_tristan on Tuesday January 18, 2022 @08:02PM (#29988504)
I'd be curious what you're working on, or if you have any links that are shareable.

This is a truly hard thing to do. I sometimes use visualization plugins in IDEs, or hand roll visualizations. For example, spit out an HTML page that basically lays out up some textarea columns with sample data between code. But it's usually really, really ad hoc. And of course, very company confidential so I can't share much...

I'm also curious about using something like this d3-graphiz project to, say, animate a sequence diagram: https://github.com/magjac/d3-graphviz - just haven't gotten around to it yet (the demo seems like it could be handy: https://bl.ocks.org/magjac/4acffdb3afbc4f71b448a210b5060bca)

Re:How do you visualize code? by hutzlibu on Tuesday January 18, 2022 @09:30PM (#29989156)
"I'd be curious what you're working on, or if you have any links that are shareable."

Not yet, but soon I publish. Maybe some screenshots I could do till then. From what you wrote above, it sounds like it might interest you, though. Basically, I compile code into flow graphs and blocks, that are navigable with mouse/keyboard - and every element can be edited visually, but also as code. So you still code as you are used to - but also get the visualisations automatically for free. It works, but only with simple code.