3 ms·
One thing I haven't seen mentioned is drawing a graph of dependencies using Graphviz. It's immensely useful for my current task - removal of two obsolete, funda
by b0rsuk 8y ago
One thing I haven't seen mentioned is drawing a graph of dependencies using Graphviz. It's immensely useful for my current task - removal of two obsolete, fundamental variables from a convoluted permission system spanning a very big project. As a bonus, managers love it because it offers visual feedback.
Normally, unit tests would be the solution, but my ticket spans more than 10 modules (files), some of them suffering from the God Class syndrome. It's infeasible for 1 person with only moderate experience in unit tests to write enough tests before he's fired for not showing results. But it made me realize how important having unit tests in place is, and I made a resolution to write them for my future tickets spanning a single module.
Graphviz uses a super simple DOT notation that is perhaps best explained through showing the gallery. If you click on a graph image, it takes you directly to the source.
https://www.graphviz.org/gallery/ https://www.graphviz.org/gallery/
With a big enough graph, GUI tools like Dia or Astah.net just don't cut it anymore. Graphviz lets you focus on the only thing you care about - content, and the visualization algorithm takes care of positioning. Because the format is a text file, it's a very good fit for git, you can attach a modified graph to each git commit.
Graphviz is also a great fit for vim. For example, to color all edges leading to particular node, you can type:
:%s/-> ParticularNode/-> ParticularNode [color=red]/gc
Or you can manipulate lists of nodes or edges with VISUAL LINE select mode and type :sort. Lots of possibilities.
It's easy to extend a graph copying and pasting modules (subgraphs with cluster_ prefix ) or anything else, and it supports attribute inheritance so you can cut down on redundant lines. Just declare a node style, for example:
node [label="update"]
update0;
update1;
update2;
update3;
update4;
node [label="create"]
create0;
create1;
create2;
create3;
node [label="\N"] // this resets node labels to default behavior
This way you can have the cookie and eat it. All methods of endpoints are uniformly named, but it's not ambiguous which one is which.
And the kicker - graphviz was initially developed by AT&T, so you have a BIG NAME to back up your tool choice.