Sequence Diagram Generator Tool - My First Clojure Project

This is my first Clojure project (I am still a Clojure newbie).

Documan is a tool for generating document and diagrams. Currently only generating sequence diagrams in SVG format using dali (https://github.com/stathissideris/dali) is implemented. The details of the sequence diagrams need to be specified using a DSL (sublime syntax file is provided).

I would really appreciate any reviews/advice to improve my Clojure skills.

Thank you.

3 Likes

@manoj

Why use a DSL instead of clojure data structures?

1 Like

The intended target users were not familiar with clojure. To implement this tool, I chose clojure over another languague (say javascript which I am more familiar with) only for the purpose of learning clojure.

1 Like

If you really prefer a text format, check out Instaparse, would make your life easier on that front. It’d also allow you to support what @drewverlee mentioned easily as well. If say EDN was your ‘native’ format, you could then just write a translator from the parse output to the native format

In terms of general style, you generally want small functions (generally 10 - 15 lines max), alone or composed with others acting over some set of data, with your IO at the ‘edges’. So say your main create-sequence-diagram might just call a few function, that read the input and options, then perhaps format/shape that and pass that stuff to a main processor (that in turn decomposes stuff further) that returns a dali data structure, then writes the output of the processor to a file.

Sorry about the delayed response. Thanks for the feedback.

Sure, I will take a look at Instaparse in detail, so far only got a chance for a quick look, it seems to be very powerful.

Thanks for the advice on the style, it helps. I will try and refactor it as soon as I can. Being new to programming with immutable data structures, I struggled trying to break the logic into smaller functions.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.