← All notes

Pseudo-code for hairy logic

Got some hairy logic? Get the LLM to write you pseudo-code for how it works.

Here's the prompt I used on the logic that matches NPP bank payments in SupplyWise:

can you review and present to me the NPP matching logic in the form of pseudo-code, just to highlight how the key logic works. I'm not interested in syntax or specific variable names, I'm only interested in the flow. Make it terse but readable.

That's about a 90% reduction in the code I'd have to read to understand what's going on.


My mate James said to do a Graphviz diagram as well, but I actually find the pseudo-code easier to read. I like it when I want all the small details, but in a form 10x shorter than the real code. I do like diagrams for higher-level concepts, or where most of the code matches a flow diagram without a lot of steps in each box.

I'd actually like my whole code base as pseudo-code, where I can click through on names to jump to different parts.