{"id":9222,"date":"2020-10-19T12:57:25","date_gmt":"2020-10-19T16:57:25","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9222"},"modified":"2020-10-19T12:57:25","modified_gmt":"2020-10-19T16:57:25","slug":"programmatic-programming-with-graphviz","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9222","title":{"rendered":"Programmatic Programming with Graphviz"},"content":{"rendered":"<p>Correl Roush has <a href=\"https:\/\/correl.phoenixinquis.net\/2015\/07\/12\/git-graphs.html\">a very nice post<\/a> that beautifully illustrates the idea of writing code to write code. It\u2019s a tremendously powerful idea because it lets you leverage some other program or programming language to do a task that requires specialized knowledge to code or is otherwise too hard to do directly. Examples that I\u2019ve used are writing code to generate <a href=\"https:\/\/en.wikipedia.org\/wiki\/Troff\">troff<\/a> source as an intermediate to producing typeset output and code to generate <a href=\"http:\/\/www.graphviz.org\/\">graphviz<\/a> source as an intermediate to generating a graph.<\/p>\n<p>Roush gives us a nice example of generating graphviz (<a href=\"https:\/\/www.graphviz.org\/doc\/info\/lang.html\">dot<\/a>) source code to produce a nice looking graph. The particular problem she\u2019s addressing is building a tool that you can point at a git repository and have it produce a nice graph of the commits. That seems unreasonably hard if you approach the problem <i>ab initio<\/i> but is very tractable if you leverage git and graphviz to do the hard work. Git can produce a topologically sorted list of commits and graphviz can do all the drawing of the graphs. All  Roush has to do is add some glue code.<\/p>\n<p>Roush decided to work in elisp and builds up her application step by step. She starts by showing the <code>dot<\/code> input she wants to produce and then writes the code to produce it. By iterating through more complicated graphs until she gets the final result, she shows to build the application iteratively, a programming method that I especially like.<\/p>\n<p>I also like the way Roush uses data abstraction. Her list-based implementation may or may not scale to huge git repositories but her use of data abstraction makes it almost trivial to move to a more efficient implementation if required.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Correl Roush has a very nice post that beautifully illustrates the idea of writing code to write code. It\u2019s a tremendously powerful idea because it lets you leverage some other program or programming language to do a task that requires &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9222\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-9222","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9222"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9222\/revisions"}],"predecessor-version":[{"id":9223,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9222\/revisions\/9223"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}