News for hackers. Stuff that matters.
Re:Visual Programming Doesn’t Suck by pjc50 on Tuesday January 29, 2019 @09:30AM (#19026526)
People are (rightly) skeptical of this, but I think the first paragraph has the right idea:

> diagrammatic reasoning in particular, is a formidable tool-set if used the right way. That is, it only seems to work well if based on a solid foundation rooted in mathematics and computer science

Code is formal: the symbols have a nearly-unambiguous interpretation as a running program. If there are to be diagrams they must be formal and systematic in their use of notation.

In particular, the author is right that some control systems and interactions are best thought of as state machines, and statecharts are the traditional tool for reasoning about these.

However, the bitcoin ATM example gif in the middle also shows what the weakness is: that's not a complete diagram! It lacks all the error and early return states, timeouts etc that would be needed in a real system. Admittedly this plagues traditional programming as well - qv. exceptions vs. Go style mandatory error checking.

Trying to do a whole program this way also seems like a bad idea; that's the hell of UML that was briefly a fad (qv Rational Rose). Maybe we can just sprinkle a bit in the right places?

Having the diagram represent "control flow" seems to be an anti-pattern, since it gets bogged down in detail. Either dataflow, event flow or state transition seems to work better.

I sometimes wonder if the right way forward would be something a bit like the old "pic" language: https://www.oreilly.com/library/view/unix-text-processing/97... ; SVG is too complex and too XML to cleanly interleave in a program, but pic might work well.

Re:Visual Programming Doesn’t Suck by arianvanp on Tuesday January 29, 2019 @01:45PM (#19028835)
The Idea of statebox (From glancing over the paper on their homepage) is that you draw architectural diagrams. And then these Petrinets have some kind of category-theoretical encoding. Which allows us to interpret the high level architectural diagram to a low level program, by telling what exactly the nodes and arrows do. These interpretations then fill in the gaps on whatever the architectural diagram has (like error handling, UI drawing, whatever).

This is similar to free monads, where the choice of specific interpretation of the DSL is delayed, and even multiple interpreters can exist

Re:Visual Programming Doesn’t Suck by zozbot123 on Tuesday January 29, 2019 @03:31PM (#19029550)
> ...you draw architectural diagrams. ...Which allows us to interpret the high level architectural diagram to a low level program, by telling what exactly the nodes and arrows do

This is not a new idea at all - I'm strongly reminded of the whole Model Driven Architecture brouhaha back in the 1990s and early 2000s. Needless to say, it didn't work. You can't do "code generation" from a high-level architectural diagram and expect to end up with a functioning system! At best, if you really do it right, the high-level design might enable you to specify type-like properties that constrain the low-level implementation in a broadly helpful way[1]. But you still have to write all the low-level code!

[1] And this is in actuality incredibly optimistic - MDA and UML didn't even manage that! Instead, all the pretty diagrams (1) were inherently fuzzy, so they did not embody any actual constraints on the implementation, and (2) even in the best of cases, got immediately out of sync with the ground-level truth of the actual implementation.

Re:Visual Programming Doesn’t Suck by wires on Tuesday January 29, 2019 @08:36PM (#19031772)
yep UML and such don't have what we think of as sensible semantics.

> if you really do it right, the high-level design might enable you to specify type-like properties that constrain the low-level implementation in a broadly helpful way

so this is exactly what we do. we have a general way to specify boxes and wires and if you give me some sort of type system and a functor and voila, we can produce some well behaved code. nothing is hand-wavy about it, or "complex", like specialized flags or properties of boxes, just some simple mappings

Re:Visual Programming Doesn’t Suck by wires on Tuesday January 29, 2019 @02:51PM (#19029292)
Hi, the ATM is mega simplified, we tried modelling the entire machine and it not easy. But we are quite convinced it is possible, but it demands features from the language that we have not implemented yet tho.

Error handling is not really a problem, in fact, a lot of the time is spend thinking hard about each and every error that can occur and modelling it out ~ making sure the machine behaves well.

Problems are rather about machine synchronisation and how processes communicate (or rather, can we autogenerate proofs about their behaviour under communication).

thanks for the comments