4 ms·
Go-Diagrams is a Golang port of diagrams [1], an Internal DSL for Python. Diagrams (the name of a software project) models cloud IaaS resources as network graph
by sradman 6y ago
Go-Diagrams is a Golang port of diagrams [1], an Internal DSL for Python. Diagrams (the name of a software project) models cloud IaaS resources as network graphs and exports DOT [2] files that can be processed by Graphviz compatible tools.
Neither Python nor Go are ideal languages for implementing an Internal DSL, compared to say Ruby or Groovy, so the first question is why an Internal DSL vs. the DOT language (or another External DSL) and the second question is whether Python or Go are expressive enough for this use case? I think the answer in this case is that any language that supports Class-like structures can provide a namespace to describe the common resources, relationships, and constraints found in cloud IaaS.
I'm assuming that the DOT language does not have the facilities to add domain specific names and constraints so an Internal DSL is a perfectly reasonable approach even if it generates intermediate DOT files.
[1] https://github.com/mingrammer/diagrams https://github.com/mingrammer/diagrams
[2] https://en.wikipedia.org/wiki/DOT_(graph_description_language) https://en.wikipedia.org/wiki/DOT_(graph_description_languag...
- throwaway93919z 6y agoI'm not sure if you've ever tried to maintain diagarms in plantuml or dot, but it becomes difficult over time to keep them up to date. I haven't used Python or Go diagrams but I have been a big user of plantuml for over a decade now. Off the top of my head, here are the main logistical problems with it: * It sits on its own * Hard to "share" metadata * Difficult to manipulate once put into the DSL * PlantUML has 12 different languages in one tool I took a look at Python diagrams and a light bulb went off. Something that would make it so much easier for _everyone_ to contribute. Most people don't want to use PlantUML. But a DSL in Python? Could pay dividends. I will seriously consider Python diagrams for my next project.
- wanghq 6y agoJust curious, do you always create a new HN account to comment?
- kelvie 6y agoSimple DSLs are sort of Haskell's bread and butter, I'm actually somewhat surprised there isn't a decent flowchart DSL in Haskell (I know about https://diagrams.github.io/gallery.html https://diagrams.github.io/gallery.html, but it didn't seem straightforward enough to get a simple flowchart going).