News for hackers. Stuff that matters.
Re:A Trick to Reaching Flow by tylerc230 on Wednesday April 05, 2023 @10:09PM (#35463233)
If I need to stop in the middle of something, I’ll often write directly in the source code, at the point where I stopped, exactly what I was working on and what to do next. I don’t comment out these instructions to my future self so when I sit down next, the project won’t even compile.
Re:A Trick to Reaching Flow by zxexz on Wednesday April 05, 2023 @11:29PM (#35463802)
This is the way. The only way I can stop coding and stay comfort able, when it’s getting late, especially if it’s something even mildly interesting, is to do a borderline incoherent mind dump and break the linter/formatter. Just all my thoughts, what I was working on, other places I may need to change code. I usually end up closing the laptop before I describe the why, but the act of writing it all down usually makes that come back before I’ve finished reading the first few words the next time I revisit it. I’ve found this remarkably effective to the point I often just do a mind dump the moment I feel tired at all, and end up in a better place than if I kept pushing.
Re:A Trick to Reaching Flow by nhoughto on Thursday April 06, 2023 @06:31AM (#35466518)
Yep

Couple of, retrospectively, often almost incoherent sentences to capture top of mind state when I give up because it’s late.

I’ll write this gibberish comment here because I’ll definitely forget what I was doing and if the compile fails I probably won’t miss it!

Re:A Trick to Reaching Flow by eyelidlessness on Thursday April 06, 2023 @12:41AM (#35464207)
I don’t usually leave notes, I just leave the last thing I looked at in whatever arbitrary failure state it was in, unsaved, with whatever undo history I stopped at. If the errors aren’t immediately obvious, a couple cmd-Zs is usually all it takes to jog my memory and at least start retracing my steps
Re:A Trick to Reaching Flow by adastra22 on Thursday April 06, 2023 @12:54AM (#35464279)
What editor configuration are you using that saves undo history like that?
Re:A Trick to Reaching Flow by zxexz on Thursday April 06, 2023 @01:24AM (#35464478)
I’m not who you’re replying to, but I hope my input will be helpful.

I just use Jetbrains IDEs on projects with the IdeaVim plugin (integrates so well with the IDE, it’s pretty much my only must-have plugin for any software, beyond uBlock Origin), and Vim for external files (scripts, etc., or when I want to use a specific plug-in for editing).

By default IntelliJ (PyCharm, GoLand. any Jetbrains IDE…) has a pretty large undo history, and that can be extended to however long you like. The real killer, however, is the extended local history for the file, which is arbitrarily (or at least seems to be) long. Combine that with the wonderful built-in git history (which can be a separate pane/window!), and you’ll never worry about changes you’ve made being lost, or overwriting other history, no matter how overzealous you were with said changes.

I find IDEA’s built-in tools so useful I barely ever even think of using git stash or git shelve anymore (or directly calling ~30% of git commands for that matter), and those are commands for which I still have 20+ aliases for in my .bashrc.

Re:A Trick to Reaching Flow by The_Colonel on Thursday April 06, 2023 @06:46AM (#35466617)
Intellij's local history saved my ass a couple of times.

Its git features are also quite comfortable. Very nice diff, I like very much the "Show history for Selection", live git annotate (with GitToolbox plugin). I don't often do rebase, but when I do the interactive rebase is also very helpful.

Re:A Trick to Reaching Flow by senbrow on Thursday April 06, 2023 @01:10AM (#35464385)
Any decent editor if you don't close it/hard power off the workstation.
Re:A Trick to Reaching Flow by adastra22 on Thursday April 06, 2023 @07:17AM (#35466838)
I was assuming he meant something persistent.
Re:A Trick to Reaching Flow by eyelidlessness on Thursday April 06, 2023 @02:19AM (#35464836)
Closing my laptop and leaving it on a charger. Wish I had a better answer. I use VSCode and it does restore undo history on relaunch for the most part, but I can’t remember if I configured it for that, and I definitely don’t trust or rely on it. I know it definitely doesn’t work if I accidentally invoke “reload”.
Re:A Trick to Reaching Flow by amoss on Thursday April 06, 2023 @02:26AM (#35464881)
uptime 8:26 up 38 days, 9:49, 4 users, load averages: 1.59 1.51 1.60
Re:A Trick to Reaching Flow by kqbx on Thursday April 06, 2023 @02:38AM (#35464974)
undo-tree for emacs can do this. I think spacemacs enables this by default

https://stackoverflow.com/questions/2985050/is-there-any-way...

It really saves the whole tree, not just the path that was active at the time of exit.

Re:A Trick to Reaching Flow by barefeg on Thursday April 06, 2023 @01:53AM (#35464658)
I also write in the code what I was doing so the code doesn’t compile. My only issue is that I don’t trust my computer, for me, if it’s not pushed in Git then it can disappear at any moment. If the work is not too important and I could easily re-create it from scratch the next day then I’ll leave it in my local Git. But if it’s important then I also want to push it.
Re:A Trick to Reaching Flow by withinboredom on Thursday April 06, 2023 @02:55AM (#35465076)
The failures I've experienced in 20 years of spending ~8 hours a day with one:

- SSD failure within moments of getting started for the day

- backlight failure

- mouse/keyboard failure

- human failure (spilling coffee on the computer)

Each time, I was out of commission until I got a replacement or the computer repaired and someone else had to pick up my work. If your computer becomes a brick, it doesn't really matter what you thought you wanted to do next.

Re:A Trick to Reaching Flow by ozim on Thursday April 06, 2023 @03:01AM (#35465128)
Still if you worked on something whole day you should have commits that someone could pick up.

Let’s say that last note of the day does not have to go to repo.

But I would expect some commit chain that would be useful produced and pushed.

Re:A Trick to Reaching Flow by withinboredom on Thursday April 06, 2023 @05:10AM (#35466034)
Personally, I very rarely push commits unless I’m about to open a PR.

A coworker fell off a ladder and broke both his arms. We had to look at his commits to figure out what he had gotten done. It was worthless. Absolute trash. His finished code was always top notch, but his WIP code … trash.

It was easier to ignore it and start from first principles than to try and pick up where he left off.

Re:A Trick to Reaching Flow by pl90087 on Thursday April 06, 2023 @06:55AM (#35466671)
If your philosophy is to do a PR at least every few days then the negative impact of this was likely negligible, especially comparing to have a fellow dev being out with having broken arms for a few months.

If you do PRs every few weeks then that could be a bigger issue. But then this should be a lesson to just not do that. Merge small steps often. It has tons of advantages.

Re:A Trick to Reaching Flow by sanitycheck on Thursday April 06, 2023 @07:23AM (#35466881)
I've had all these plus PSU failure, network adapter failure, OS post-update self-destruction and more.

I push code a couple of times a day. If something something goes horribly wrong I just pick up another computer, pull the code, and continue working while I wait for a repair/part for the main computer (or for an OS to reinstall).

If your computer becomes a brick, just use a different computer.

Re:A Trick to Reaching Flow by withinboredom on Thursday April 06, 2023 @08:30AM (#35467456)
That assumes you have another computer that isn't a brick. I have 6 other computers within this house, yet only one other one (my wife's) is currently functioning.
Re:A Trick to Reaching Flow by sanitycheck on Thursday April 06, 2023 @08:53AM (#35467683)
Yeah, true, I'm assuming most people here have old machines that still work. It's good to have one, if you don't!

My secondary is a 10-year old laptop which gets regularly used while sitting in bed in the morning, occasionally for actual work. The other backup is an old desktop I donated to my wife a few years ago, containing an unplugged SSD which is exactly as it was when I last used it. Both will still handle most of what I need, just a bit slowly.

Re:A Trick to Reaching Flow by pl90087 on Thursday April 06, 2023 @08:53AM (#35467684)
Either you have been extremely unlucky, or a good time investment for you would be to fix a few of the non-working ones. That's likely a better use of your time than wondering how to leave notes to your future self.
Re:A Trick to Reaching Flow by withinboredom on Thursday April 06, 2023 @11:08AM (#35469349)
I was actually advocating not to bother leaving notes for yourself.
Re:A Trick to Reaching Flow by littlelady on Thursday April 06, 2023 @04:12AM (#35465666)
Why is that a problem? You can create a branch called "in-progress" or something like that and push that to remote.
Re:A Trick to Reaching Flow by di456 on Thursday April 06, 2023 @10:17AM (#35468599)
Draft PR's are nice on these branches to get a quick visual of the diff.

I self-review my draft PR's and catch all kinds of weird formatting, messy or missing comments, and general clunkiness before imposing it on others to review.

Re:A Trick to Reaching Flow by iamthejuan on Thursday April 06, 2023 @03:01AM (#35465126)
I thought I was the only one doing this. This works!
Re:A Trick to Reaching Flow by maccard on Thursday April 06, 2023 @05:04AM (#35465999)
I write C++, so I use `#error start here, implement the FOO`

It works surprisingly well!

Re:A Trick to Reaching Flow by ralferoo on Thursday April 06, 2023 @08:23AM (#35467389)
Even easier with C-like languages: a bunch of blank lines above and below something like `xxxxxxxxx;` at the point I planned to continue working. Instant compile fail if I try to run and also very obvious on any "git diff".
Re:A Trick to Reaching Flow by nickjj on Thursday April 06, 2023 @07:29AM (#35466940)
This works well near the end of the day or before a weekend too where you spend a few minutes dropping in a brain dump of context near the code you're working on so you can pick it up the next day and also avoid having to actively think about forgetting an important detail. This helps you enjoy your time away. A double win.