Live data from Hacker News

Create system diagrams with Go

github.com

11–20 of 70 posts

Re: Create system diagrams with Go

#13
post #7

Very nice, but IMHO this should be the engine behind a file that could easily be parsed such as YML / JSON. I really don't see the point in having to write a Go snippet to describe the architecture: in the end you're providing only data as an input. I guess I'll try to do what I just described because I feel like this could have a lot of potential for my system diagrams

yaml is a serialization format. You need at least a schema at which point you might as well write in a nicer language.

I agree with OP on this, YAML seems better suited for such a tool as you can easily add some form validation to it and then serialize it into Go data structures. You really shouldn't have to recompile your codebase in order to modify a diagram.

Re: Create system diagrams with Go

#14
post #11
post #10

For someone who doesn’t care language, what’s the difference between this and the original diagrams tool?

It's written in GO! :P

Is this tool beyond creating diagrams? If not, I don’t grasp the point of porting, writing the diagram is like scripting, for which python is arguably a better choice.

I hope this isn’t a trend similar to Atwood's Law: “Any application that can be written in JavaScript, will eventually be written in JavaScript.”

Re: Create system diagrams with Go

#15
Great! I am a fan of seeing diagrams being generated instead of manually drawn.

I was a bit disappointed however to find out the project uses Graphviz/DOT under the hood.

What would be the reason not to try a newer rendering engine such as as the Eclipse Layout Kernel (ELK)?

Re: Create system diagrams with Go

#16

Very nice, but IMHO this should be the engine behind a file that could easily be parsed such as YML / JSON. I really don't see the point in having to write a Go snippet to describe the architecture: in the end you're providing only data as an input. I guess I'll try to do what I just described because I feel like this could have a lot of potential for my system diagrams

> I really don't see the point in having to write a Go snippet to describe the architecture: in the end you're providing only data as an input.

Writing a program to generate the diagram is similar to writing a program to generate your infrastructure which is exactly what you do in "infrastructure as code". If your infrastructure is simple then you may not need infrastructure as code. The same can be said for diagrams but at some point you might want the flexibility if the "diagram as code" approach.

Re: Create system diagrams with Go

#17

Very nice, but IMHO this should be the engine behind a file that could easily be parsed such as YML / JSON. I really don't see the point in having to write a Go snippet to describe the architecture: in the end you're providing only data as an input. I guess I'll try to do what I just described because I feel like this could have a lot of potential for my system diagrams

> I really don't see the point in having to write a Go snippet to describe the architecture: in the end you're providing only data as an input. Writing a program to generate the diagram is similar to writing a program to generate your infrastructure which is exactly what you do in "infrastructure as code". If your infrastructure is simple then you may not need infrastructure as code. The same can be said for diagrams…

It all depends on the context, you're right.

I was more thinking about my use case without considering all of the possible use cases such as Infrastructure as Code, which this project seems more suited for.

My use case is to create simple explanatory diagrams about a concept / idea rather than a real-world scenario: in those cases, I always end up using Draw.io. This causes me to waste a lot of time dragging and dropping around just to illustrate something simple :(

I guess that with my solution (which btw I'm developing here: [0]), you get a versionable diagram from a YML file that can be parsed and exported everywhere thanks to GraphViz. My idea of the input YML file is the following: [1]. This is a YML representation of the architecture shown in the README.md.

[0]: https://github.com/denysvitali/go-diagrams/tree/feature/pars...

[1]: https://github.com/denysvitali/go-diagrams/blob/feature/pars...

Re: Create system diagrams with Go

#18
post #9
post #3

The result looks nice. I think this type of diagramming need to be as straightforward as possible, with as little typing as possible. I see you use many different types. For example gcp.Database.Sql(diagram.NodeLabel("Database")) What does the NodeLabel type provide that you would not gain with just the string?

It's an implementation of the functional option pattern used a lot in go code. See https://dave.cheney.net/2014/10/17/functional-options-for-fr... for a rundown.

It's a functor, though the type system doesn't let you write a reusable fmap.

Re: Create system diagrams with Go

#19
Every time I have to create a diagram I struggle. If I want something quick and dirty the options are out there. But if I want to create a diagram for a serious project, I have trouble. Ideally, I would love a solution that integrated with templates and allowed me to define my diagrams at a "higher-level". It should also integrate with Latex to look consistent. Does anyone know of a better alternative to TikZ for my use case?

Re: Create system diagrams with Go

#20
Now if this could read something like say Terraform and be able to (if all your infra was defined in terraform) keep infrastructure diagrams in sync with production instead of the idealized thing we think they are that’d be reallly cool.
Post reply on HN