Comment by paddy_m

Comment by paddy_m 2 days ago

3 replies

re:version control

How stable are node and edge IDs and their ordering? Could you sort the JSON before saving so the output is more stable and diff-able?

Another thought is, how would you code up a flow like this in your preferred language if you were just writing code in that language (you didn't care about the visual editting). Call most of the same functions, but do it directly. Ok, think about that, then write a transformation from the NODE language to output source in your preferred language.

I have some sense that coding this type of control flow logic doesn't work well with text line based diffs because of the complexity of the problem, less the syntax.

Towaway69 2 days ago

> Could you sort the JSON before saving so the output is more stable and diff-able?

Jsons are definitely diff-able but it's the difference between a change that changes the logic of the flow or a change that is purely visual and has no affect on the logic of the flow that is hard to distinguish by just diffing the JSONs.

Remember the Json contains location of nodes and labels of nodes as well as logic of nodes - if a label of a node changes it doesn't affect the flow logic or how it works.

So if the value of an 'x' changed, that means the node moved along the x-axis. Did the value of 'func' (function value for a function node) change, then that is a logically change. Now what change is important if you only looking at the JSON. So you need to remember that 'x' and 'y' are visual, 'func', 'tmpl', 'rules' are logical. And what is important for each node isn't the same across all possible nodes ...

> this type of control flow logic doesn't work well with text line

Exactly that's why places like GitHub would need a lot work to support visual coding in proper way. Diffs would have to become like image comparisons that line-by-line diffs.

And that is partly why visual coding has taken off - the tooling isn't available.

  • HappMacDonald 2 days ago

    I wonder what would happen if they structured the JSON so that control-relevant information was just saved in a different place than visual/label-relevant information? EG, seperate form from function and thus more easily determine which has any changes in a diff?

    • Towaway69 2 days ago

      There really isn't a good way to compare visual code textually. It similar to attempting to compare 3D scenes in 2D - textual code and visual code are a dimension apart in their representation.

      I created a visual comparison that combines both visual and semantic textual changes for NodeRED[1]. For me that is the only solution: visually comparing visual code.

      [1] https://flows.nodered.org/node/@gregoriusrippenstein/node-re...