DEV Community

How do you shift between the coding mindset and other head spaces?

Ben Halpern on September 25, 2018

I find myself having to shift between different frames of mind, in my work and otherwise.

My code brain is different from the brain I need elsewhere. How do you do it?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

How I get through the day:

while true {
    input = get_senses()

    if input.type == human {
        if random.next_bool() {
            self.smile()
        } else {
            self.nod()
        }

        self.voice( "mhm" )

    } else if input.type == love {
        self.service_stop( service::reason )
        self.service_start( service::emotion )

    } else if input.type == code {
        self.fingers.echo( input )

    } else {
        self.drink( coffee )
    }
}
Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I'll hijack my own comment for a serious response.

I have a feeling one's ability to switch mindsets may be, in part, significantly genetic. Some people are just better at switching than others. I learned at one point it happens to be a skill of mine. Perhaps my ability to lead a team, talk with other teams, and juggle side-jobs and projects, came from this ability, and not vice-versa.

I'm sure everybody can improve this ability, but I suspect they'd be subject to the same constraints and problems I am.

First off, it's draining. Every switch takes a little bit of energy. Even if I don't notice it during the day, I notice it in the evening. When I'm sick I notice the ability slips away. As I get older it gets harder. If I'm facing questions of my career goals, it gets harder again.

I maintain a healthy lifestyle to keep up my energy.

Second, it requires a certain level of mindfulness and prioritization. In order to switch to a new task requires putting the old task out of your brain, and pulling in the environment of the new one. You can't keep mentally working on an old situation, nor only work with part of the frame of the new one.

There's all sorts of things that prevent this transition. Worry is a big factor. Procrastination another. Boredom is also an issue -- it's hard to transition to a boring mindset. Both big and small picture details can get in the way. Figuring out a way to just say, "fuck it, I'm working on -this- now" is key -- yet provides no clear avenue for achieving that.

Perhaps the ability to switch mindsets is tied more to your overall health. The fitter you are, the easier it is. Perhaps this is what drew into becoming so fit, learning massage, meditation, and ultimately to mentoring and coaching.

Collapse
 
bluebell_lester profile image
Bluebell Lester

When I read this I feel sorry for your brain. It is not a robot-slave. No need to push it like that.

Collapse
 
pavonz profile image
Andrea Pavoni

In my algorithm, I also authenticate with user and password in the morning.

My problem is that sometimes I forget credentials to log in into my brain, at least until the next alarm clock ;-)

Collapse
 
scrabill profile image
Shannon Crabill

"Sorry, I can't work today. I've been locked out of my brain. K, thx"

Collapse
 
900107561 profile image
900107561

That didn't work, i got an error.

Collapse
 
dance2die profile image
Sung M. Kim • Edited

I believe that the mind follows the body & vice versa.

If you need a different frames of mind, you probably need be in a different place physically.

Collapse
 
himamegahed profile image
Ibrahim Hasan

Totally agree usually, I go out to have a cup of tea & donuts with some beautiful landscape so that I can ease my eyes ☕️🍩❤️❤️

Collapse
 
dance2die profile image
Sung M. Kim

That's what I typically do as well. I go to a local cafe to read and think with a nice cup of coffee & donuts ☕️🍩❤️❤️

Collapse
 
bgadrian profile image
Adrian B.G.

Definatelly, I need to get up and move away a bit from the laptop or close it before I can focus on something else.

Collapse
 
dance2die profile image
Sung M. Kim

At home, I walk to the living room and sit and come back :)

Collapse
 
dandevri profile image
Danny de Vries • Edited

Small little trick that works really well for me: make different users on your MacBook. I have one 'personal' user and one 'work' user. Each have different programs installed and are logged into different accounts.

Even if I'm in the same space physically I switch between roles.

Collapse
 
zackdotcomputer profile image
Zack Sheppard

I do something very similar to this except using Spaces on my Mac, but yeah a "distractions" space, a "work" space, and a "code" space.

Collapse
 
dandevri profile image
Danny de Vries

You mean the integrated macOS spaces you can switch between? A lot of people seem to like Workspaces by Apptorium.

Thread Thread
 
zackdotcomputer profile image
Zack Sheppard

Very cool! Thanks for the tip, I hadn't heard of that app yet, will give it a try.

Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

This sounds interesting! I will try this

Collapse
 
qm3ster profile image
Mihail Malo

:o

Collapse
 
david_j_eddy profile image
David J Eddy

Lets look at your question from a different angle: why switch at all? In my own life trying to normalize, automate, and provide redundancy is a minor goal for every day existence. Coupled with short/med/long term goals a road map becomes apparent to the end desired state.

Car breaks? Ride share back up.
Fridge empty? Shop / Food delivery.
Life knocks you down? Have a flow to get back in the zone.

At the end of the day always be working towards something. What is the desired end result of an action; programmatic user interaction or going to the DMV. Have a goal and work towards it. This way the coding brain is adapted to the goal brain.

Hope this helps

Collapse
 
johnnytwowheels profile image
johnnyTwoWheels

What I try to do:
Observe
Orient
Decide
Act

What actually happens:
Distraction occurs
Mind wanders
Go get more coffee.

I believe changing mindsets requires very intentional effort.
A change in physical surroundings helps me break free from where I want to leave (mentally) and makes it easier to enter the new desired space.

Collapse
 
binarypatrick profile image
BinaryPatrick

Isn't that a military thing?

Collapse
 
progrium profile image
Jeff Lindsay

Yeah, OODA loop developed by John Boyd. Great thinker. There's a few books on him, all recommended. It's found its way into a lot of other contexts.

Collapse
 
johnnytwowheels profile image
johnnyTwoWheels

Yes it is.
I just use it to help me switch contexts, whether I'm coding, or in a meeting, or interviewing someone. The technique works for me.

Collapse
 
alanmbarr profile image
Alan Barr

I usually will change my location often times location is associated with an activity. When I am coding vs when I am testing are two different mind spaces. In order to be creative it requires a habit of trying out new things and combining them. I like things like oblique strategies cards (Ambiguous Oracle) and exercises from "A Whack on the side of the Head" by Roger von Oech. Some simple strategies would be did you try laughing at your idea? What if you reversed it? Ask what if's in general.

Collapse
 
ben profile image
Ben Halpern

That's good advice

Collapse
 
weirdmayo profile image
Daniel Mayovsky

This questions bothers me as well, from a bit of a different angle/experience.

After doing JS coding for more than 2.5 years more than 5 hours a day I, sometimes, find myself with such issues like:

  • Slow response to basic questions (What is your name takes me 15 seconds to think about)
  • Memory read/write efficiency. Takes forever to remember things and hard to remember.
  • ADHD symptoms.

When I do large breaks from programming, like going on a 2 week trip, they go away one by one and I become a totally normal human being without any of those issues. When I dive back into what I love, I become slow and unresponsive outside of coding. And it takes me forever to switch back into normal human mode.

How do you switch/unload your mind faster than a 2 week trip?

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

ADHD is so perfect for this type of work. Getting locked into coding for hours on end feels so good to my brain.

At the end of the day, if I've left something unresolved, it's almost impossible to pull me out of that mindset. I end up being at home, but not really being there. I miss my family. Like you, responding to what should be very basic questions seems to take forever.

Music has been a big help; it's always an option, but it doesn't always do the trick. It probably helps that I'm a musician. Any amount of travel is the cure-all for me, too. As soon as the road is opening up before me, my creative self emerges.

The thing that helps me the most: #ITakeMyPills

Collapse
 
weirdmayo profile image
Daniel Mayovsky

Well I am 18, and I am not diagnosed for ADHD yet (which means I can't claim that I don't have one, but most likely I don't).

It is necessary for me to be able to switch the mindset on a whim, since I am in college and I have family and other stuff that are in need of my attention sometimes. Of course I would really like to lock myself in a room for some coding, if that option would be available.

I love listening to music and I play bass, but it usually slows me down instead of putting me back onto a "normal human being" path. But yeah, I guess just focusing on one thing would be a good thing for me later...

Collapse
 
nickyhajal profile image
Nicky Hajal

This is such a great question!

My wife is from Barcelona and for about 6 months before we were married we had to be outside of the US as we waited for her visa. We stayed at a family place they have about an hour South of Barcelona in a somewhat rural area.

I spent most of my days there coding but twice a week we'd go to a little family-owned farm where they taught Spanish-style horseback riding. I'd never done it before, but it seemed like a fun experience (it was!).

There was a 20-minute drive to get there and pretty much without fail I'd be in a less-than-agreeable mood the entire ride. I'm a pretty positive person, but we'd go in the middle of the day and my brain was 100% in code-mode. I was still thinking through issues, stuck in the mental map of my work and just didn't want to talk or deal with the outside world (which made me a pretty bad adventure-companion).

The funny thing, though, is that as soon as we started getting the horses out of the stables and saddled up, I'd snap out of it. And by the time we were riding, my mind was just completely clear, in the moment, laughing, smiling. The car ride back would always be full of energy, conversation, and happiness. Completely night-and-day shift and nothing changed but my own mental space.

Thinking about it now - this definitely does happen in other ways and I'm actually not sure I've really given it the attention to find a reliable solution.

It seems like what worked well with the horses was having something physical and slightly dangerous, which forced me to focus on the present moment and break free of my code-mind.

I wonder if there's some hack to achieve similar characteristics in an office setting, that can be done on the way out the door.

Collapse
 
scrabill profile image
Shannon Crabill

I tend to say tasks aloud, to myself that require a mind shift. If I'm putting something off, like, writing that self-evaluation that's due in 3 days, saying "At 4 o'clock I'm going to work on my self-eval" helps. It's weird, I think, but it helps me. Sometimes I timebox it with "I'm going to work on documentation for 30 minutes".

For me, knowing when I'm liking to be a better or different mindset is key. Morning are busy—hello, meetings—and I get bored with production work in the afternoon, so that's when I do my more focused tasks like writing or updating documentation.

I try to be intentional in what I do, when I do it and not multi-task.

At home, I find it easier to get overwhelmed and not get into the right mindset due to—seemingly—competing priorities. Do I unpack that box or try to debug that thing? OR do I find another cooking show on Netflix?

Collapse
 
williamholt profile image
William Wheat Holt

My background is in PR so the parts of the day when I'm interacting with people, meetings, presentations, writing, etc, are when I'm at my most natural.

I often find that I have to "trigger" the right mindset when I'm coding. Put in my headphones, sit at my desk, pull up just the programs/files that I need for this specific feature, and find the Flow zone.

Collapse
 
rlxdprogrammer profile image
Marcell Lipp

Sorry, I can't give a proper question, but I think I have the same problems.
Last time my wife asked me to go to the supermarket and buy some stuff. When I arrived she was not satisfied with the things I brought. I just told to her, that "the specification was wrong". First she got mad and since that she has never sent me to the super market alone...

Collapse
 
adriantoddross profile image
Adrian Ross

Have you ever played The Sims? In The Sims 3, they put more emphasis on how certain activities get you "in the mood" for focus, play, and even romance! wink wink I've found that physically doing things (and maybe even physically moving into different rooms or places) helps me detach & transition into a different mindset.

When coding, the activities before I begin working usually revolve around tech: reading stuff on here, maybe some Codewars, or even just watching YouTube videos.

When I want to break away, I use different activities to encourage & inspire me to do something else. Time to relax? Netflix, video games for an hour or two, or watch Twitch. Time to exercise? LOUD, bumpin' music from Spotify, and lots of posturing in the mirror.

Speaking of this, I really need to reinstall The Sims 3. LOL.

Collapse
 
mdabek profile image
Marek Dabek

Mindfulness really helps. It teaches to be here and now. I noticed, that after practicing mindfulness for a month, I could better focus on a task and my mind did not drift chasing other thoughts.

Collapse
 
darksmile92 profile image
Robin Kretzschmar

Like many others in the comments here, it applies to me too, that I need to change something physically to change my mindset.

To shift from work to private, I mostly need to:

  • get up from my desk
  • leave the office (also for home-office)
  • have a chat about none-work related things with someone
  • get some fresh air
  • switch laptops to not get "work feeling" again.

To shift from private to work, I mostly need to:

  • remember the previous day (short rundown) to get on track again
  • check my phone one last time so I can leave it alone the next hours or so and don't have the feeling of missed messages
  • turn on some good music (depends on my mood)
  • discuss something with my collegues to get my mind started (sounds crazy but helps a lot sometimes)
Collapse
 
zackdotcomputer profile image
Zack Sheppard

My coding brain is my most focus-hungry brain, so for me shifting to coding usually requires getting a focus-friendly space created. That usually involves two halves, one being body comfort (get a cup of coffee or a glass of water, use the bathroom, settle into a chair or standing desk) and the other being distraction limitation (put lyrics-free or very familiar music on my noise-cancelling headphones, settle myself somewhere where I'm unlikely to be bugged for input on other problems, turn on Do Not Disturb on my Mac).
As you can kind of guess from that, my challenge is getting into the coding brain, so getting out of it is usually as easy as taking off the headphones.

Collapse
 
emmanuelobo profile image
Emmanuel Obogbaimhe • Edited

Great question. I remember asking this same question (worded differently) some time ago. Since then I have gotten better at this. What has really helped me is the following.

  1. Writing things down - I notice part of the reason it was challenging for me to fluently transition into another frame of mind is because I still had stuff on my mind from what I was previously involved in. If I was working on a problem, I would subconsciously still be thinking of a solution hours after I stopped actively working on it. So what I did was I write down where I left off, what are some potential solutions and anything else I find important. That way my mind is more at rest knowing that when I come back to it all my thoughts are there on paper to pick up from. If I get a new idea while doing something else, I'll just take a quick note on my phone or something and intentionally remind myself to get back to it later.

  2. Wind down/warm up - before I make a sudden switch to a new frame of mind I like to wind down what I was previously doing before moving on. It gives me a kind of closure (my bad if this sounds romantic lol). So for example, as I previously stated, I like to write things down, I also take a quick overview of what I did for that time being, run a few mental checks, give myself a pat on the back and now I am satisfied and ready to put it away for the day. And vice versa, when I want to switch back to a working/logical mindset, I read my notes from last time, run the program, admire it, then start working on whatever tasks I have starting from the easy ones. This works for other things as well. Before you give a talk, have some kind of routine that gets you into a nice flow.

  3. 'Throw it out, move on' - lets say you don't have enough time to warm up/wind down. In this case I just have one phrase that I tell myself when I'm switching gears and my mind is still thinking on the last thing I was doing. 'Throw it out, move on'. This just reminds me that I am in a different zone right now. Whatever I was previously doing is not relevant to what I'm doing now. I used to play competitive sports and one thing we were taught was 'next play'. So whatever we did in that play, once it's done, its done its not relevant anymore. Your focus should be on whats current. I incorporate this ideology to my day to day life. Once work is done for the day, its done, whats next? Once I'm done hanging with friends, that was cool, we'll catch up again later, now back to work.

Hope this helps.

Collapse
 
chacho60 profile image
Chacho • Edited

Ah! Context switching!

For the most part of my life my problem with getting out of the "code mind" is not much about getting out but getting back to it. Having ADHD makes your mind wander out of focus with not so much effort

I like to use lists for that.

If you breakthrough your day you'll see that most of it it's just a series of problems and tasks to take charge of. When you realize that and start automating your real-life tasks, going between code-mind and non-code stuff gets easier.

Making lists has helped me this way, it gives you direction when switching contexts. If I'm at work my work-list focuses me into the work-related things I should be doing. If I'm at home my home-list tells me the chores I should be doing.

That way if something gets me out of my mind in some situation, I can easily turn back to focus just by reading the list.

Of course you can't make a list for everything in life, but after some automation the rest gets a bit easier.

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

I can't always remember to do what I'm about to recommend, but visualization helps me to shift gears. There's power in your mind, the very thing that is trapping you!

I imagine myself taking all of that work stuff off of my shoulders like a very heavy coat. I hang it up and pick up the much lighter one that contains my son's contagious laughter, the cool fall air, and whatever else I wrap into its fabric. I do it before I get out of the car, and when I walk in the door, it's generally enough.

Also, if your partner is in the same industry/mindspace as you, make sure you have a standing rule that you don't talk about it at home except during reserved times.

Hope that helps!

Collapse
 
jacoby profile image
Dave Jacoby

I don't know.

I'm in a Perl shop that does web, and so, going back and forth between Perl, SQL, JavaScript, HTML, CSS, JSON, YAML, Handlebars, Mustache and Template Toolkit, I've had days where I was unable to hold a conversation, my head was so jumbled.

I try to do everything I can in JS, then everything I can in Perl, and so on. It can be as little as "What are comments right now?", but that can be enough.

And then there's "dealing with users" brain, and because I'm in the middle of a thought when they come to me, so I need to switch out of code brain quickly. In those cases, the sentences that start with "I'm sorry to bother you. I know you're busy" are far more frustrating than those that are direct and blunt. I'm much more open now to saying "Come back in five minutes" to give me time to finish and transition.

So "Give yourself transition time" is all I can add. I hope someone else comes up with something better.

Collapse
 
williamrandol profile image
William Randol

So, my typical switch comes when someone has a question for me. I first give the interrupter a "one moment" gesture. I continue working on the code until I find a place where I feel comfortable pausing. I then let them know I am ready. They will ask their question. By the time they have finished asking their question, I have figured out what new headspace is needed, and I will ask them to repeat their question. For some reason the switch to trigger the new headspace cannot be flipped until the question is asked.

Collapse
 
tedhagos profile image
Ted Hagos

I listen to music. That usually shifts perspectives. Sometimes I listen to "sounds of rain" for about 15 minutes. That does the trick too. Another thing I do is to "snack" (not good for my BMI, but it shifts perspectives too)

Collapse
 
noblebe4st profile image
Jeff Hall

Well I’m not very good at that. I am at my best when I am singularly focused, to the exclusion of everything else. That’s also when I most enjoy my work. We all want to be the best we can be, and for me, well, that’s how to get there.

Having said that, I also want to be the best husband I can be, and the best parent. I have some lingering aspirations of being an entrepreneur and I would want to do that well, but I may not. I think you have to keep a very short list, and not attach too much significance to everything not on the list. I have to accept that for everything else I will only ever be rubbish to merely adequate. Perhaps you are attached to a certain outcome in your other endeavors, and that is the source of your concern. So try this: whatever you are doing, imagine that your current skill level is as good as it will ever get. Can you still enjoy doing the thing anyway? You might find getting out of the way of yourself will open up some room for improvement.

Collapse
 
akiramakes profile image
Akira

I switch to singing or playing piano. If I can interact with music by making it (not listening to it but actually creating it in real time) it calls on a totally different part of the brain and let’s my coding brain do nothing for a bit. It’s really nice.

Collapse
 
kspeakman profile image
Kasey Speakman

Our team is together in an open room. I am available for pairing and guidance through most of the day. But I often can't get any coding work done during this time. So I come in a little later and stay later. Most of my coding work gets done in the last couple hours of the day.

Collapse
 
nestedsoftware profile image
Nested Software • Edited

I think the first question to ask yourself is "what is it about such shifts that is uncomfortable or problematic?" Once you have some answers to that question, solutions will probably become more evident.

Collapse
 
dfockler profile image
Dan Fockler

I start programming more like reading or writing than like solving a puzzle (How can I best express these ideas as code?). I also take lots of breaks. I also generally leave work at work, which helps in breaking out of any mindset I was in while coding.

Collapse
 
900107561 profile image
900107561

You don't tell anyone.

Collapse
 
d1p profile image
Debashis Dip

i guess chopping tasks to micro individual tasks is a good start, focus on the smallest problem possible so that loosing track becomes harder and harder.

Collapse
 
bluebell_lester profile image
Bluebell Lester

Get a hobby, I guess.

Collapse
 
adhocore profile image
Jitendra

comes naturally. after all human has most sophisticated brain amongst all life forms.

Collapse
 
codemouse92 profile image
Jason C. McDonald

Wait...I'm supposed to switch?

Collapse
 
birdayz profile image
Johannes Brüderl

i don't

Collapse
 
rockarts profile image
Steven Rockarts

I just have to wait for it. I can't force being in the right mindset. I'm not in the right mindset because I'm here commenting on this post haha.

Collapse
 
sharpdog profile image
SharpDog

I have different physical spaces for head-space (as much as possible). After a while, you will associate the physical surroundings with the task and it helps you switch.

Collapse
 
lewiscowles1986 profile image
Lewis Cowles

Music, sometimes intermediary tasks can be used to glue together the day. Overall like most people I do it badly if it's required in short-order.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I pretend to be in the room but I'm thinking about code most of the time. That's awful isn't it?