Ending your coding sessions in the right way
When you work on huge project with complex code it becomes difficult to keep track of what you are doing and what's been done.
We generally start work with a goal in mind. We want to add a feature, for example. Or fix this particular bug.
Sometimes we know how to do that. We know what steps to achieve and what changes are to be made. Sometimes we don't. We have to figure that out along the way.
It's like navigating a map. Sometimes you know the roads to take, sometimes you don't. You know the destination though.
After all, we can't travel all day. We need to rest too.
Now coming back to coding – When we want to take a break or stop work for the day, we are worried all the progress we made might be lost. Because all our thought process will be lost when you stop working on it. When we start work again the next day, we will have to spend some time recollecting what was done and where we were yesterday.
Earlier I used to prefer not taking a break and finish the task at hand so that I don't have to spend more time recollecting the next day.
But that's a bad habit. Taking breaks is necessary. Recharging is important. ⚡️
Note taking to the rescue 📝
What I started to do is I write some notes in code comments to help future me understand where I left and what are all the things I should take care when I start back.
Adding something like
// you were here 👈 goes a long way.
When I know what the next steps are and in which order I need to do tham, I also add numbered TODOs.
1some sample code23// TODO 2. fix this45some other logic67// TODO 1. add a parameter to the function89
It's like marking your location on a map. 📍
Writing also helps you keep track of what's been done and what still has to be. At the start of the file or at a relevant place, write pseudo code or plan the steps you need to achieve. More like documenting your journey.
Don't use your brain to remember the steps. Use it to process your thoughts on how to implement that step.
1/**2 * Get the data from API3 * - [x] get all posts data for the index page4 * - [x] now loop on it and make div for each post5 * -  get single post for the post page6 * ...7 * (you get the point)8 */9
This helps us get better context on what's going on with the project. If you are in a team, it will help others understand where you are, what's done and what's not.
That's how writing and taking notes while coding helps us. Thanks for reading!
By Aravind Balla who is a friendly human, building things for himself, and sometimes for others. You should hit him up on Twitter!