markdown guide

How I get through the day:

while true {
    input = get_senses()

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

        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 )

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.


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


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 ;-)


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


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.


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


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 ☕️🍩❤️❤️


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


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


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.


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.


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

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


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


What I try to do:

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.


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.


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.


Yoga teaches mindfulness and mindfulness is valuable across anything you're doing. It definitely helps with mind whiplash when moving from like Netflix and chill to managing difficult code.


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.


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.


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?


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


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


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.


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.


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.


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.


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


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.


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)

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?


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.


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.


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.


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.


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.


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.


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.


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)


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.


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!


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


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.


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.


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.


It's not even an issue for me. I guess your having to deal with the extra workload and stress of running makes it harder for you to context-switch ... 🤔


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.


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

Classic DEV Post from Apr 21

CSS Subgrid — Level 2 of CSS Grid

CSS Subgrid - Align nested grid items to parent grid with CSS Subgrid

Ben Halpern profile image
A Canadian software developer who thinks he’s funny.