DEV Community

Cover image for 3 ways to retain your dev flow between sessions πŸ’ͺ
Jerod Santo
Jerod Santo

Posted on • Originally published at jerodsanto.net

3 ways to retain your dev flow between sessions πŸ’ͺ

Context switching. Computers are great at it, humans suck at it.

Every time we developers lose the context of our current task we're forced to waste precious time getting it back. The harder the problem we're trying to solve, the longer it takes to reinstate its context in our mind. This is why many developers strive to reduce interruptions, set aside large blocks of time, and create an environment that helps them get into the flow and stay there.

The problem is, there are times when we absolutely must leave our development context behind and pick it back up later. Sometimes it's 30 minutes, sometimes it's overnight. I find these times very frustrating and have found a few techniques that help me quickly get my flow back upon returning.

1. Note to self

Leave yourself a little note saying what you were up to. This is probably the most obvious technique, and can be quite effective. The problem I've found with this is that I often forget to do it or am just too tired/lazy at the end of the day to do it consistently.

I need to write myself a note to remind myself to write myself notes. Guh, yeah.

2. Always be failing

Leave one or more tests in your test suite failing (you are writing tests, yes?). When you return to the project your first step is to run the test suite and you'll see the failing test(s). This one works really well, but much like leaving yourself notes it's something that you have to actively participate in. It can actually take more time and effort to employ than leaving notes.

3. Git dirty

This is my favorite and most oft used technique. Leave your Git (or the DVCS of your choice) staging area in a dirty state.

git dirty

When you return, you'll see all the changes you most recently made before you left off. This, combined with a quick perusal of the commit log will quickly bring your context back. The advantage of this over the others is that it is somewhat participation-free. Simply fail to commit your last changes and they'll be there waiting for you. At least for me, this is far more likely to happen than technique #1 or #2.

4. ???

Those are a few things I've been doing to get my dev flow back quickly, but I'm sure there are others. Do you have any tricks up your sleeve? I'd love to hear 'em!

Top comments (22)

Collapse
 
exadra37 profile image
Paulo Renato • Edited

Never leave code to be commit-ed in your machine... you may end up to learn it in the hard way, like when your disk breaks apart and you loose all your precious work.

I use ZSH shell that have pretty handy git alias:

╭─exadra37@thinkpap-l460 ~  
β•°β”€βž€  alias | grep gwip -  
gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"'
╭─exadra37@thinkpap-l460 ~  
β•°β”€βž€  alias | grep gunwip -
gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'

So my workflow is:

  • gwip to commit all dirty changes, including untracked files, therefore everything.
  • git push origin feature-wip to push my changes to a work in progress branch. This saves me in case my disk goes dead.

When I am back to the project:

  • gunwip to get back git to the same exact dirty stage it was before I applied gwip.

When I am ready to perform a clean commit:

  • git checkout feature to switch back to the branch from where I derivedfeature-wip.
  • git commit -sam 'my message' it may need git add . before if untracked files exist.
  • git push origin feature always play safe and push your most recent commits to upstream.

I hope that it helps someone :)

Collapse
 
sergsoares_15 profile image
Sergio Soares

This can be live change.

Thanks man

Collapse
 
exadra37 profile image
Paulo Renato

It was for me... Cannot live without Oh-My-ZSH ;)

Collapse
 
mertsimsek profile image
Mert Simsek

wow that is wonderful!

Collapse
 
weirdmayo profile image
Daniel Mayovsky

Will this work on a bash shell alias?

Collapse
 
exadra37 profile image
Paulo Renato

yes it will, just add both alias to your ~/.bashrc or try Oh My ZSH and I bet with you that you will not come back to bash :)

I can live without Oh My ZSH, but life wouldn't be the same ;)

Collapse
 
dance2die profile image
Sung M. Kim

When I have multiple tasks/projects going on, I usually build a mind map (after breaking down tasks into even smaller tasks) to track where I was previously.

I add checkboxes for ones I finished thus making it easy to go back and force between tasks/projects.

mindmap
blurred as it's work-related and can't reveal

Collapse
 
yorodm profile image
Yoandy Rodriguez Martinez • Edited

applies some CSI style bullsh*t to the image

So..., now I know your secrets....

Collapse
 
dance2die profile image
Sung M. Kim

Time to mindmap how to cover up my secrets πŸ˜ƒ

Collapse
 
maestromac profile image
Mac Siri

what tool is that 😲

Collapse
 
dance2die profile image
Sung M. Kim

Any MindMapping tool would do but I've been using MindMeister.

Collapse
 
jerodsanto profile image
Jerod Santo

Cool! You are undoubtedly more disciplined in your work than I am... 🀣

Collapse
 
dance2die profile image
Sung M. Kim • Edited

A down side is that a dev told he wouldn't want me as his manager lest I might micro-manage using the mind map πŸ˜› (I am not a manager btw)

Collapse
 
sergsoares_15 profile image
Sergio Soares

Great post, I do a lot #2 (Test Failing) and too failing try #1 (Leave Notes).

But man, My stage area are always dirty. How a programming is working with it clean more than 5 minutes =)

Thanks for sharing.

Collapse
 
m1guelpf profile image
Miguel Piedrafita

Turned your article into audio to listen to it on my way to school. Dropping here a link in case it's useful to anyone else :)

Collapse
 
_bigblind profile image
Frederik πŸ‘¨β€πŸ’»βž‘οΈπŸŒ Creemers

I sometimes do an extended version of the git dirty tip, where I stop in the middle of writing a function. I often find it hardest to get going in the morning, and starting in the middle of a function/class/... in progress gives me a clear first thing to do.

Collapse
 
simoroshka profile image
Anna Simoroshka

It helps me to have a checkbox/todo list of really small parts of the task. The smaller, the better.
For big problems I actually find it beneficial to have a break, especially overnight. The flow can be sometimes dangerous as you don't stop to see the big picture and ask yourself "is this what should I be doing?"

Collapse
 
aghost7 profile image
Jonathan Boudreau • Edited

Context switching. Computers are great at it, humans suck at it.

Actually, context switching is a really expensive CPU operation πŸ€“.

Collapse
 
jerodsanto profile image
Jerod Santo

Heh, fair point. The good news is CPU operations are cheap and plentiful! πŸ˜‰

Collapse
 
codingmindfully profile image
Daragh Byrne

Love it. Here is my take on flow.

Collapse
 
npandey25 profile image
nitish pandey

Use task focused workflow aided by mylyn in Eclipse

Collapse
 
andreasjakof profile image
Andreas Jakof

Call methods, which are not there, yet. Helps you structure your flow, keeps you at the problem at hand and if you leave and come back, it waits there for you to become implemented.