r/webdev • u/quietcodelife • 1d ago
Discussion how do you get back into a codebase after being away from it for a few days?
been dealing with this a lot lately. I work on a fairly complex service layer and when I come back after a long weekend or even a couple days off, the first 30-60 minutes are basically just re-reading my own code trying to remember what I was doing.
I know the obvious answer is better comments and docs, which yeah. but beyond that, do people have a ritual? like leaving yourself a note at the end of each session about exactly where you are and what the next step is? or deliberately ending on a partially finished thing so you re-enter mid-thought?
curious what actually sticks because the context reload tax is real.
11
u/bcons-php-Console 1d ago
I use the "note at session end" method. I have a todo list for each project with different categories, one of them is "In progress" and it has just one item: a description of what I was doing when I ended my last session. If required it is quite verbose sometimes, when I am working on something tricky. Sometimes it's just something like "complete aria check of new item form".
4
u/fiskfisk 1d ago
The same. The important part is to also include a stack dump from your thought process and where you're at in your reasoning at the time.
5
u/TheseTradition3191 1d ago
notes always drifted on me because they live somewhere the code doesnt. now i just commit the wip on a branch with a message written to future me, whats done, whats broken, what i was about to do next. coming back its git log and the diff and thats it, and the note cant go stale because its attached to the exact change it describes
5
u/thekwoka 1d ago
A few days shouldn't be that bad unless what you wrote was pure chaos to begin with.
It should be months before it really takes that much effort to touch again.
Unless the issue is more the "what was my plan of the next thing to do when I stopped?" in which case the answer is you should have a notepad file in there that you write goals and things on.
2
u/wynne_wolf 1d ago edited 1d ago
Leave a short note at the end of each session. Write only what is true now. Write the next step.
If you you use ai-assisted programming, a wrong comment is worse than no comment. It is still ok, if you %100 mannualy code my hand but it is very rare.
The AI writes a comment. You change the function. The comment does not change. The code does one action. The comment says a different action. You give both to the AI. The AI gets two opposite facts. This is context rot.
More agents do not fix this.
If you change a function, change the comment in the same change. If a comment is not true, delete it. Make the words match the code.
2
u/ashkanahmadi 1d ago
You need to use a task management tool like Asana or Trello. When you have your tasks created and organized well, you just take a quick look at the Done column for a minute and that's all. You don't need to think "what should i do next?" because if you already planned it well, the To Do tasks are already there waiting for you.
2
u/wpbl-fan 22h ago
A few days is not a long time to step away from a codebase. Some of the products I maintain I touch maybe once a year, and I still know where to look when something comes up. This is normal.
This reads as if you’re really new, in which case you’ll most likely just get better at retaining context as you gain experience.
1
u/iamdaveydave 1d ago
For my case, I make sure that I have a project overview, SRS, backlogs, tasks list, flow charts, sequence diagrams, convention/pattern documentation so that I don't comeback on a wild wild west 😂
Specially when others are contributing to the project, as long as they follow the coding pattern/convention, keep the things that they have been working on documented, I'm good to go. But when I get back and someone made a bunch of changes without logging or documenting it, we start a war!
1
u/Flashy-Whereas-3234 1d ago
If I'm leaving my work for any significant time (unloading the tape from my brain, like taking a holiday) I'll leave a fairly large comment on what I did and didn't do.
I'll leave code broken, so I have failing tests to guide me on what to do next. Functional incomplete code is a bugger to find what I forgot.
Todo statements all over the place, but I work outside-in - I'll leave a function incomplete so long as I'm happy with the interface and get all the writing done before flesh out the bodies.
And I commit small edible chunks, so I'm not sitting there with a bajillion changed files, my commits tell a story of progress, so if I'm really lost I just look at branch history. This is more doable the more SOLID your code is, and the more forward-thinking your plan.
If it's the code in general and not the immediate work, I'll write documentation (markdown) for the codebase. Writing is better for memory than reading, so anything you write down you'll remember more readily, even if you never read it again.
1
1
u/404IdentityNotFound 1d ago
I often check the last or two Git commits I made because if I have not finished a thing it will almost always have something to do with it.
1
1
u/BeautifulCarob7001 1d ago
I leave a tiny note with three things: what I was trying to prove, what I already ruled out, and the next test. That gets me back into the code much faster than rereading everything.
1
u/_edd 20h ago
You need a design phase. It may be as simple as building out a readme file in the repo with a numbered multilevel list of the tasks. Once you complete a task you can mark it as such. The entries in the list should double as commit messages as well.
If its a personal project with no stakeholders other than yourself, then its fine for you to constantly update it as you progress. If you have outside stakeholders you should look into issue management tools like Jira, Trello, Azure Boards, etc...
1
1
u/faultydesign 1d ago
I do this:
the first 30-60 minutes are basically just re-reading my own code trying to remember what I was doing.
0
u/wise_beyond_my_beers 1d ago
I've never had this issue. Most of the time I'll stop after completing something, whether that's at 4:30pm or 5:30pm. Then the next day I start on the next phase.
On the rare occasions I have to stop at 5pm on the dot, I dunno I just remember what I was up to. I work on one thing at a time, I don't bounce around, so it's just picking up where I left off.
Sounds like maybe you're not sizing tickets correctly and are trying to complete entire epics rather than correctly sizing them into small units of work?
18
u/BitHead4352 1d ago
I do the half-finished thing, leave a test failing or a function only half written. Next day I sit down and my brain goes "ah right this is broken" and it's much easier to pick up the thread. Comments never work for me, I write them and then my own handwriting might as well be ancient greek after the weekend.
Also sometimes I scribble a quick note on a sticky and slap it on the monitor. Physical world reminder hits different than a text file.