Skip to content

Instantly share code, notes, and snippets.

@geostarling
Created February 1, 2018 14:33
Show Gist options
  • Save geostarling/f4c29252a1741f8e47355f4a4069cde0 to your computer and use it in GitHub Desktop.
Save geostarling/f4c29252a1741f8e47355f4a4069cde0 to your computer and use it in GitHub Desktop.
Rachna [12:21 AM]
Hello everyone.
I need to document a big clojure project which i did not create(but trying to understand it at my best). It has lots of namespaces and functions. Any suggestion which software design diagrams(UML or any thing else) should I use for the design specific documentation.
It would be great if it can show which function is calling what. Or can show some kind of control flow.
andy.fingerhut [12:50 AM]
I do not have any recommendations for you, but I wanted to pile on another question -- in such a control flow graph, does anyone have good conventions for how to show that visually when functions are passed as arguments to other functions, and are then called, i.e. higher-order functions? Also for functions that return functions as return values. And of course even crazier is when you start getting into futures, promises, core.async, etc. But even ignoring those last possibilities, the earlier questions are interesting.
alexmiller [1:04 AM]
I actually spent quite a bit of time thinking about this a few years ago. data flow graphs are by far one of the most useful tools I’ve found for describing Clojure architectures. however, they completely suck when it comes to hof.
Rich draws a lot of diagrams but they are usually more process/data oriented than trying to show detailed call graphs
the slides he did for his euroclojure talk about core.async channels are the best public source I can point to show a variety of things he’s drawn about a particular piece of code http://cdn.cognitect.com/presentations/2014/insidechannels.pdf
video is at https://vimeo.com/100518968
VimeoEuroClojure
Implementation details of core.async Channels - Rich Hickey
as per subject :-)
The slides are here:
noisesmith [1:08 AM]
I have a theory that it might be interesting to do something like what we do for influencer graph analysis - we take all the connections, then look for the nodes that have the largest number of shortest paths going through - those are "significant" because they are the most vital bridges - the things that tend to be where others connect indirectly
so you'd end up with the api defining functions
alexmiller [1:09 AM]
most of the talks Rich does are much more conceptual - this one is pretty unique in being so tightly tied to a specific piece of available code
noisesmith [1:09 AM]
(I think)
alexmiller [1:11 AM]
I think you could definitely trace stuff like that
I often do function flow graphs when trying to understand a chunk of code I am seeing cold
there are some clojure tools that will make them for you
https://github.com/actsasgeek/lein-gossip
GitHub
actsasgeek/lein-gossip
lein-gossip - A tool to examine Clojure source code and generate call-graphs.
https://github.com/testedminds/lein-topology
GitHub
testedminds/lein-topology
lein-topology - A Leiningen plugin that generates the data for a Clojure project's function dependency structure matrix.
https://github.com/gfredericks/clj-usage-graph
GitHub
gfredericks/clj-usage-graph
clj-usage-graph - Haxy usage graphs for Clojure projects
I’m just googling, no idea on how good any of these are
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment