DEV Community

Ben Halpern
Ben Halpern

Posted on

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

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?

Oldest comments (56)

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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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?

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
 
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
 
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
 
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
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

This sounds interesting! I will try this

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
 
qm3ster profile image
Mihail Malo

:o

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.