Live data from Hacker News

Why is it so hard to see code from 5 minutes ago?

web.eecs.utk.edu

111–120 of 424 posts

Re: Why is it so hard to see code from 5 minutes ago?

#111
post #50

Reading the comments, I'm stunned and disillusioned. Are most modern developers struggling to write code without this? If so, there is a fundamental problem that has nothing to do with levels of undo.

Likewise. This whole thread is totally bizarre. The closest imaginable thing I might do is wrapping some block of code in an if(false) {..} or #ifdef it out, when I'm refactoring and feeling unsure about my changes. But is that even the same thing that we're talking about here?

Hello from the bizarro universe of people who do this all the time and can't imagine the opposite. Do you never rewrite some code only to realize it didn't precisely capture all the edge cases of the thing you rewrote? In those cases I use the git gutter in VSCode to view what the old code looked like and compare and contrast to the new version to see what I missed. It seems to me that that's the same as what these engineers are doing, just with a bit more primitive tooling.

Can't imagine how anyone doesn't do this - unless there's just a race of God-programmers I've never encountered that write everything perfect the first go. But I don't think so. :-)

Re: Why is it so hard to see code from 5 minutes ago?

#112
post #105

I've just started using ZBrush recently, and one of my favorite ideas in this software is their timeline scrubber. You can just drag through undo/redo history to get back to the point in time that you want very quickly. I could see this being similarly useful in code.

Same. Perhaps a different time scale but I’ve considered doing this for files within a source code repository to better familiarize myself with the history.

One interesting feature might be to be able to select any two commits such that you could diff them in isolation.

Re: Why is it so hard to see code from 5 minutes ago?

#113

> Want to know what we saw developers doing instead? They either duplicate code files or took screenshots of relevant code while in the middle of a change. Even I have done something similar before: I'm about to mess this up... I'll Ctrl-A and Ctrl-V this into a new tab before it gets too messy, and then I can put the window beside my editor to use as a reference. I even observed a professional developer with 20 year…

I made a similar comment and now I recognize that what we’re doing is branching outside version control. And I also recognize it’s still sensible to do, and that to the extent version control feels like friction this is yet another case where the interfaces to it aren’t good enough.

And I don’t just mean “git cli is a bad ux” (though I mean that also), but that the whole world of version control is poorly serving rapid prototyping and other exploratory flows.

It’s pretty likely aliases could serve some of this by wrapping a lot of fast paced idea checkpoints into a set of git actions. But it still would be disruptive for eg any intermediary file system side effects if it’s not faster than whatever watcher you have running.

Re: Why is it so hard to see code from 5 minutes ago?

#114
Does anyone know of something similar that lets me watch data "flow" through my code at a human readable pace?

I dont use ctr-z, Its surprising to me that people code this way, but I do tend to spend a lot of time thinking about how my data would flow through my current code set. It would be great if I could easily and almost cartoonishly visualize it. Anything like that out there? gdb is just to abrubt an harsh to use.

Re: Why is it so hard to see code from 5 minutes ago?

#115
post #98

Earlier quoted context omitted.

I'm so confused as to why anyone would do this.

I write a lot of frontend JS with hot reloading make change => see result => cmd-z 1 time to fix result OR commit and keep coding oops, it wasn't really fixed. cmd-z 3 times and see if that works I know it's wrong, but what's right?

> I know it's wrong, but what's right?

Nah, it's not wrong. You're testing your code changes live.

Re: Why is it so hard to see code from 5 minutes ago?

#116
I don't have this much at all.. But I do stage and commit pretty aggressively (with the occasional file-backup when I 'm lazy to branch and know I'm going to frewheel a bit) and look at local git diffs when I want to look back. Of course rebasing/squashing before pushing to a PR or merging.

Re: Why is it so hard to see code from 5 minutes ago?

#118
post #70

Earlier quoted context omitted.

I certainly don’t commit things every five minutes, so this doesn’t help.

In my 30 years of professional programming, and even with my admittedly declining short term memory, I have never felt lost without access to versions of code from 5-15 minutes ago. Not to be harsh, but I really think that this indicates some fundamental approach issue rather than a tooling problem. If it cannot be written on paper (or tablet note with pen) as rough pseudocode... or even drawing boxes and arrows for…

> One aid I do lean on heavily though is a REPL. Load the code and do some interactive work with it. Inspect the data, test some transformations, and then write code to do what works. That's my current approach to situations that I cannot immediately and accurately write in one pass.

Honestly, this sounds mostly like what you're chastising, except you're doing it outside of the main workflow.

Post reply on HN