I Want This Code Visualizer

schwern on 2008-01-04T03:54:57

I want this. A thing that let's you visualize how the routines in your program are interconnected and how complex your routines are.

In particular...

* Lines pointing from the current routine to other routines it uses. * Lines pointing into the current routine from other routines which use it. * Lines connecting any global (which includes lexicals scoped outside a routine) your touine uses to all other uses of the global to show just how they interconnect (and toss encapsulation out the window). * A visualization, either with color or length, of the length of each routine. * A visualization of how deeply nested a routine gets.

Those last two, in particular, are really good, cheap indications of complexity.


Interesting...

jplindstrom on 2008-01-04T18:05:37

I tried something similar in PerlySense, but I consider it a failed experiment.

In the Overview, there is (well, was) a Signature Survey of the file, i.e. a char for each type of "thing" in the file (pod blocks, subs, statements, string literals, etc). Like this:

* Structure *
;;;';;;;;;;{;";}{;;;;{}"";{}"";";}{;;;';';";;;{;'";;';;;
};';}S{;";"";;}S{;' {}{"};;;}S{;;;;";";;};
I got the idea in an interesting article about Software Archeology.

I had hoped it would give me a kind of ambient feel of the structure of the file, but I found it didn't actually do that for me. Maybe it could have worked better with color highlighting, maybe it didn't actually represent anything useful. So I removed it in later versions.

Looking at the image you linked to it's clear that may work better. It could also be an indicator next to each sub/method being displayed in the Overview (On a more visionary time scale (i.e. not right now) I'm also thinking of indicating complexity, edit volatility/vcs activity with sparklines, test coverage and stuff there).

Something simpler

sigzero on 2008-01-04T19:13:08

I have only seen something that breaks code into a flow chart. Nothing so fancy as what you want to see.

Swoosh, swoosh

jplindstrom on 2008-01-05T16:43:31

I saw this on Reddit just now.

More cool than useful perhaps, but definitely very cool :)

Here's a kinda-sorta solution

drhyde on 2008-01-07T12:01:22

Many years ago I was having trouble remembering how my code interacted with itself, so wrote this. It produces a text report of what subroutines call what subroutines, and what subroutines are called by what subroutines.

The code is hideous, and I wouldn't dream of writing it that way now, but on the other hand it does mostly work, and might make a good starting point. If anyone wants to have a go at improving it, be my guest.