XinMatrix · Public Ledger

CodeViz · I Drew a Diagram and Still Couldn’t See How My Code Ran · Ledger 17 · XinMatrix

Chen Xin (XinMatrix) · Public ledger
In one lineRun the code once and auto-generate a flowchart of the whole project

Tried several technical approaches and reached a conclusion; no product yet

Latest update

Tried every implementation route for "CodeViz" and reached the key conclusion; no product yet

I Wanted a Picture of My Own Code

Sometimes I can’t tell what the code I wrote is doing. Where does the data come from? If I change this line, what else will move?

I wanted to drop my code into a tool and have it draw a diagram. I pictured boxes and lines like Houdini’s node editor, with boxes you could click to see inside. The diagram would have layers like Photoshop, so I could look at function calls, data flow, variables, logs, and dependencies separately. I also wanted to follow the lines back to where data was defined and see the order in which the code ran.

I planned to sell it as software. Any company could use it to draw a diagram of its own project.

I Drew the Diagram, Then Followed the Program as It Ran

I started by reading the source. The syntax tree let me see how the file was put together, which functions it contained and which ones might call each other. I put the variables, functions, relationships, and logs into an HTML dashboard. I had a diagram. It couldn’t show what actually ran.

Then I added probes. At each point I wanted to check, the program recorded where it had got to and what data it held. That showed me the path it took on that run. I kept several versions of the code and their intermediate results in a test directory. I still wanted functions to look like rooms I could click into, with a view from outside that showed every line the project ran. I kept tweaking it and never got the picture I wanted.

I ended up with several working prototypes. Besides variables, functions, relationships, and logs, I tried views of individual files, folders, connections across the project, and individual lines. I kept the code for 8 steps, 4 sets of test folders, and a lot of data from actual runs.

After Trying Three Approaches, I’d Start by Having AI Read the Code

Later I tried Cursor, Copilot, CodeRabbit, and Cody to see what happened when AI read the code directly. With syntax trees and runtime tracing, that made three approaches I got working.

To see the exact path a program took, I still have to trace the run. When I just want to understand the code, having AI read it comes closer to how I read it myself. That makes it the most practical approach for me right now. Cursor works on the same idea.

That’s where I stopped the research. I didn’t record exact start and end dates, so for now I list them as “not disclosed.” I haven’t started the product, and users and revenue are both at 0.

If I pick it up again, I’ll start by giving the code to AI. Once it can explain one part of the flow, I’ll draw that part first.

Open the interactive version ↗