r/codereview • • 20d ago

Functional Wanna see how your code thinks? 🤔

/r/leetcode/comments/1xvaj4j/wanna_see_how_your_code_thinks/
1 Upvotes

5 comments sorted by

1

u/DickBrainTime 18d ago edited 5d ago

I'd most want object identity and mutation history, not just the current line or scalar variable values. For example, with let a = [1]; let b = a; b.push(2), show a and b pointing to the same heap object, and highlight the mutation to that object. The same idea is especially helpful with linked lists, trees and recursive functions where several frames hold references to one node.

For recursion, a timeline showing each frame's own locals, the return value and which shared objects changed would make backtracking much easier to understand. Two small UX details: show why a branch condition evaluated true/false, and let someone jump backward to the last mutation of a chosen variable/object rather than stepping through hundreds of lines. I'd also cap trace length or sample large loops so the visualization stays usable. I haven't tested AlgoLens; this is the specific kind of DSA debugging view I'd find useful.

1

u/SquashHot4348 18d ago

This is genuinely some of the most useful feedback I've received.

I especially like your point about object identity and mutation history. Showing two variables referencing the same heap object, and then visualizing how a mutation through one reference affects the other, is something that could make AlgoLens much more useful for understanding DSA problems.

The recursion frame timeline and jumping directly to the last mutation are also really interesting ideas.

I'm considering making object/reference tracking and mutation history part of the next major improvement, rather than just showing variable values at individual execution steps.

Really appreciate your suggestions!

1

u/SquashHot4348 17d ago

This is some really thoughtful feedback! Thanks for taking the time to explain it in such detail.

Actually, AlgoLens already has a call-tree and memory visualization in its side panel. You can also click on a variable to jump directly to the corresponding point in its execution, making it easier to understand how and when its value changes.

I really like your suggestions around shared object identity, mutation history across recursive frames, and jumping directly to previous mutations. These are interesting directions for making the visualizations even more useful.

I'm also working on another usability update that's coming soon, which should make the overall experience more convenient.

Really appreciate the suggestions! Feedback like this helps me think beyond just tracing lines of code and focus on making execution easier to understand.

1

u/jazzmyne_Rebela 17d ago

sounds like an execution visualizer or tracer? hard to tell what youre pitching without a post body or snippet though

1

u/SquashHot4348 17d ago

Yeah, that's pretty much it! AlgoLens is a code execution visualizer built specifically around the LeetCode workflow.

The idea is to help you understand how your solution actually executes, rather than just reading the code. It traces execution step by step, highlights the currently executing line, and visualizes variable changes and the call stack.

It supports Python, Java, C++ and JavaScript.

I built it because I felt that understanding how an algorithm executes is just as important as knowing the solution itself.

Here's the extension if you'd like to take a look: https://microsoftedge.microsoft.com/addons/detail/jhhkkpabkoeaiajdilomalbmjdppcmcc