GUI to create templates

Hi everybody! How it’s going?
I’m a ~1-month old damler and not a long ago I was introduced to daml templates visualization tools.
So my question is, can we flip it in opposite direction and imagine a GUI application for creating Daml templates? The idea is if we have an unambiguous way to produce diagrams from code, can we produce code from diagrams?
If I move forward with it I can imagine a game where players can initialize a negotiation process. And a result of that process will be a new template stored on the ledger. The process itself is a DAML contract. Usually, we negotiate over the terms of the contract. But there we can try to create a new template as we do in the code editor.
Does it make sense? What do you think?

Hi @VictorShneer,

I would caution against going down that route. We can produce a diagram based on the code because the code has all the information you need to create a diagram; however, the reverse is not true: the diagram does not contain enough information to produce the code.

Now, you could go down the path of trying to make a more complex diagram that would include all of the same information we have in the code. But at that point you have to ask yourself what the point of the diagram is. The current visualization tool is meant to give you a simplified view of the overall structure of the code; missing information is kind of the point here as we want to have an overview, with details removed.

Trying to include all of the information necessary to produce the code directly in the diagram will result in either very complex, hard-to-read diagrams (and at that point, why not just read the code?), or the need to develop a fairly sophisticated tool to explore the diagram interactively so you can hide the information you don’t want to see at a given time but still have it embedded.

Lots of people have tried that second approach for a variety of languages. Huge numbers of person-years have been invested, and to the best of my knowledge and experience the final result has always been significantly less practical than notepad.exe.

I’m not aware of any property of Daml that would make it different from other languages in that regard.

Of course, as a professional developer, I’d be delighted to be proven wrong here. If you can come up with a new technology that significantly improves my ability to develop code, that’d be great.

1 Like

Apart from @Gary_Verhaegen’s very valid remarks above on the feasibility, the idea makes sense in the context of rapid development application and prototyping but in general I would recommend not to establish a very tight coupling between data on the ledger and the outermost layer of your application, so that data on the ledger and your UI/service can evolve independently over time. I like to describe Daml as “the backend of the backend”, a synchronization bus on top of which your service layer can be built to serve external customers and UIs.

1 Like