48. Context Switching

February 6, 2018

On today’s show we discuss context switching. We all know how much time can be spent on changing between projects and how distracting arising issues can be. The data around just how much time is wasted is quite startling, but how do we manage the multi-project nature of most of our work? We break down a few different strategies for minimizing wasted time and the ensuing frustration. Whether the distractions are internal, external, necessary or not, we could all do with a bit more control of what we afford our attention at what time and for how long. Listen in to hear all about it!

Key Points From This Episode:

  • Just how much time can be spent adding one other platform.
  • How to avoid context switching.
  • Using the Pomodoro Technique to save time in switching.
  • Pairing up to save time from internal and external distractions.
  • Using a calendar to break up project work.
  • The bat-person as a means to filter out distractions.
  • The Focus app and disabling notifications.
  • Teach & Learns from the team.
  • And much more!

Transcript for Episode 48. Context Switching

[0:00:01.4] MN: Hello and welcome to The Rabbit Hole, the definitive developer’s podcast in fantabulous Chelsea, Manhattan. I’m your host, Michael Nunez. My co-host today –

[0:00:10.0] DA: Dave Anderson.

[0:00:11.0] MN: And today, we’re talking about context switching. Often times, you get interrupted throughout the workday including just now because it took us forever to start this recording.

[0:00:21.3] DA: Yeah, what did you have for breakfast again? No, let’s not do that. Let’s stay focused.

[0:00:26.6] MN: Probably not Cheerios by the way. So context switching is something that happens to all developers I believe. Whether you have someone who is looking for you to fix a production bug, to a new thing that comes up in the story, so many other things.

[0:00:44.0] DA: Or someone needs a code review that could be or Slack. Slack is like the killer of context. I just so wish, just blowing up with memes and gifs and important things too like new feature requests or bugs or what have you.

[0:01:02.2] MN: Yeah and it depends on how many Slack channels you have and where you are like at Stride, we have Stride, Slack where everyone can communicate with one another but we also are often in the plain Slack channel which is like you’re two times interruptible.

[0:01:21.3] DA: Oh my gosh, exponentially. There’s some channels too that I’m like, “I don’t know why I subscribed to this,” like photos of puppies coming through, people wishing happy birthday to every other person. Yeah but it’s interesting though. There’s studies, scientific data that says, “You know if you just introduce one more project or one more task to your plate,” like just going from one to two, you’re going to lose 20% of your time just switching back and forth on that and trying to keep things straight. Never mind the puppies on Slack.

[0:01:56.4] MN: Yes, that’s very interesting. So depending on the project that you are working on is 20%?

[0:02:02.5] DA: Yeah like if they are both meaty projects. There is a pretty good article from Jeff Atwood where he goes into it and if you keep on piling on the projects then eventually it gets to the point where you are doing nothing but just thrashing. You are just sending Slack updates to people and emails to people being like, “Yes I am doing it,” but you’re just writing the emails.

[0:02:22.8] MN: Right or you’re not producing liable code depending on the project that you are on.

[0:02:27.7] DA: Right, yeah that’s true.

[0:02:29.2] MN: I imagine it would be even more difficult depending on not just the project but the context of where it is whether it’s different programming language, you have to go and shift and change to. Like if you are switching projects from one Ruby code base to another Ruby code base, I imagine that requires some energy of context switching but then like going from Ruby to like I don’t know, let’s say React. It probably takes more energy to do the context switching which causes more time spent on context switching in general.

[0:03:03.4] DA: Right, yeah because especially since there are different paradigms at play. They’re both dynamically type languages but things that would be more functional in Java Script whereas this is more like DSL-like and friendly in Ruby probably. Yeah but so what are some of the ways that you can get around this? How do you avoid context switching?

[0:03:29.6] MN: Well step one, don’t. I guess I am joking when I say that but I’ve heard methods of like supposed you’re working alone or it’s solo work where you’re not paring. Like put on over the ear headphones is like a clear indication that you do not want to be disturbed. I feel like that is the best way.

[0:03:50.9] DA: Universal symbol.

[0:03:52.6] MN: The universal symbol of do not bother me. I am in the middle of something. If you feel like you are getting a lot of external interruptions, that is a way to do it. I find that to be way too harsh to people at the client. So if I need to listen to music then I would have at least one of them off.

[0:04:11.8] DA: Right just being open to the possibility.

[0:04:14.6] MN: Yeah to the possibility of an interruption. I feel like in the event that you are interrupted, I try to write an index card of what the interruption was about and see if I can context switch at a later time, where it is viable for me.

[0:04:27.9] DA: Yeah, I often like to do Pomodoro and one of the tenants of doing a Pomodoro is you have a 20 or five minute of time, whatever time you want and then if someone tries to interrupt you during that time then you’ll be like, “Wait, I’m going to finish this” and then in 10 minutes or 15 minutes I’m going to get back to you and if it is that important then you drop it and you go for it.

[0:04:53.9] MN: Right, yeah I think Pomodoro is very helpful because it enforces you to have like, “Oh I’ll look at that when I have a chance”. It is probably going to be on the break, the five minute break. So just keeping and storing what the request was from another individual and then getting back to it later without being interrupted is probably the best way without having a context switch in the middle of the thing that you are working on.

[0:05:16.6] DA: Yeah, I’ve been in situations where I just start thrashing where I have 300 different tabs open in my browser and looking at different sources of information, people are pinging me and just being able to put everything in a neat box really helps.

[0:05:34.2] MN: Yeah, one of the things that I was grateful at one of my clients was that the project manager insisted that each developer only had one story to work on and I think that when the organization is aware of how expensive context switching is it can be very beneficial for you to get that one task that you’re assigned done.

[0:05:55.2] DA: Yeah just do one thing.

[0:05:56.8] MN: Right, I think he might have learned from prior experience to know that when a developer has three or four things on the Trello or Jerry board it’s never going to move because there’s just so many different things at work.

[0:06:11.0] DA: Yeah and also if you get something to a certain point and you are doing your one thing and then you get to code review, you get to QA and you’re just like, “Okay now I am going to take up another thing,” then who’s going to be the guy whose going to push out over the final line or the point? You’ve got to do it, you’ve got to own that and do your one thing. I think another thing that really helps is just pairing in general because you’ve got each other’s back, its a buddy system.

Be it like internal distractions from the client, the situation that you’re working in or I guess that’s really external a little bit. Internal would be like, “Oh I want to check my phone right now. I need to see what’s up.” Like those text messages and external things from the work at process and whatnot.

[0:07:04.9] MN: You feel guilty when you want to go and check your phone and working with someone else because then you are almost wasting their time too. Immediately the person next to you doesn’t care what’s on your phone unless it is really important and you share that. So you’re less likely to do that and put it away and there are things I’ve noticed for the sake of context which do not download this app but it is pretty cool. It’s called Pushbullet and it will actually change your –

[0:07:32.6] DA: Writing it in a card, right? Like a card.

[0:07:33.8] MN: Yeah, so Pushbullet will take all your notifications on your phone and will pop them into your screen if you need to see it like if there is a message that comes in because I have an android phone but I use a Mac at work.

[0:07:45.5] DA: Oh okay.

[0:07:46.5] MN: It’s pretty cool but I tend to turn that off so that I don’t disrupt my pair from seeing the notifications that happen on my phone and I only turn it on when I expect a message and I need to see either a phone call or a text message or that kind of stuff but you don’t want to be distracted or take time from your pair. So you kind of inadvertently don’t do it at all, which is great.

[0:08:10.4] DA: Yeah, I guess if there is something becomes important like a bug or some status update needs to happen, the navigator can take the hit and break off and deal with that and let the driver keep on going with the work.

[0:08:26.2] MN: Yeah, I think the navigators role in that aspect is pretty clutch when it comes to capturing all of the information that happens externally when someone comes over to your desk and tries to interrupt, the navigator can mitigate that and say, “All right, we’ll take that into consideration. We’ll finish this thing. I will write a note down and we’ll get to it to later.”

[0:08:49.9] DA: Yeah, I dig that. The buddy system.

[0:08:54.2] MN: Yeah, so I think another aspect that I have seen before in time is when dealing with multiple projects, you work on those projects on certain days of the week. So like I worked at a place that had two different projects, two different websites that they managed and Monday through Wednesday, we worked on this one project with all the stories and then Thursday and Friday we worked on another project and that allowed you to only focus on those projects in those days.

[0:09:25.3] DA: Okay, that makes sense. So you guys say you are doing the context switching overnight when you are going to sleep.

[0:09:30.3] MN: Yeah, exactly.

[0:09:31.3] DA: So it’s not really a big deal.

[0:09:32.8] MN: Yeah and you take the performance hit or rather the context switching hit once and that’s on the new day that you come in.

[0:09:41.6] DA: Right, yeah that’s a good idea. I think it is also really important to just have a really good plan. Like actually working with people to prioritize things appropriately and make sure that you are doing the most important thing because sometimes if you are just taking things every day as they come in, it can be really easy to just be like, “Okay this new thing this looks really important. It’s so shiny. This bug or like this button we really need to add it.”

And then you just keep on changing where you’re going like wherever the wind is blowing. So to be able to decide all of that stuff upfront and then go for it and spread, just classic agile or just even a grooming session doesn’t have to be so formal but you know just getting that done before hand to think about it all day.

[0:10:33.9] MN: Right, I think like things that I have seen is in the event is something as interruptible will get brought up to the individual and then we’ll get it brought up like during standup like on a parking lot or at a time where everyone is together and they can bring up this particular situation, that way you can plan and be like, “Okay that sounds like a thing we should estimate and we’ll do that in the grooming session coming up this week. or we can all ad hoc try to figure out what to do with this. But not do it while you are working on something. It’s just a different meeting, stand up as a different meeting that allows you to kind of take care of those situations that come up.

[0:11:15.6] DA: Right, yeah. I guess that passing the bucket a little bit, delaying the decision and the context switching until the last responsible moment.

[0:11:24.5] MN: Another thing you can use to mitigate some context switching would be to have a batman or batwoman on your team.

[0:11:35.3] DA: Oh yeah, the bat-person.

[0:11:36.4] MN: The bat person, yes.

[0:11:37.4] DA: We’ve talked about the bat person before.

[0:11:39.0] MN: Yes, the bat person is a really, really good way to kind of manage context switching for a particular project because that person is responsible for handling all these different things that come up at the same time.

[0:11:53.5] DA: Right, yeah. So just lumping all of the distractions together into the opposite of distraction, the easier job is to be distracted.

[0:12:02.9] MN: Yes, to be distracted, to prioritize the distractions and then be able to knock them out throughout the week.

[0:12:11.0] DA: Yeah, that’s awesome. People should definitely check out that episode. I like talking about the batman.

[0:12:15.7] MN: The batman, the bat-person.

[0:12:19.0] DA: Yeah, are there any other apps that you could use to help with being focused with context switching?

[0:12:25.0] MN: Yeah, actually, today, I was told of an app, shout out to Ian McNally, I met up with him for coffee recently.

[0:12:32.8] DA: Friend of the show.

[0:12:33.4] MN: Friend of the show, always a friend of the show. He brought up the app called focus, I googled focus app and it’s a way that manages your do not disturb on your Mac and it pretty much like you’re can have it do Pomodoro style or like just activate focus mode and it will like t urn off all your notifications for all your applications that you currently have, just so you can focus on work.

[0:13:01.1] DA: Cool, I did that. I mean, even like a really low level trick is just, you can actually turn off notifications on OSX by clicking on the upper right hand corner and you know, turning the slider for notifications off or you can also do like an option click up there and get that done in one shot.

Which is awesome, just saving you some more clicks but I like the idea of like having it managed the Pomodoro for you and like you know, that seems pretty cool.

[0:13:36.0] MN: Yeah, I think I like another feature I saw on the focus app was whenever you want to break your focus, you have to type in a password. It’s just like another step that you have to do to break your focus and you’re like wait, no, let’s not do that. Then you cancel.

You could type in your password I think it unlocks all the things and everything turns back to normal. It can also block like – if you open up certain tabs with – you can have like a white list of only the websites you want to visit so that the ones that you are normally distracted to, i.e. reddit.com and like –

[0:14:12.4] DA: Yeah, just keep Slack overflow open.

[0:14:14.5] MN: Yeah, make sure you have Slack overflow and the application you’re working on, that’s it.

[0:14:19.3] DA: No thanks. They’ll whitelisted and like, we’ll give you a redirect to not – to be focused.

[0:14:26.4] MN: Continue being focused. Yeah, I mean, the most distractions that usually come in are like nowadays from an application whether it’s like an email notification or like Slack and I believe focus can turn all of those notifications off and then when they turn on, you actually get like a message that shows you all the things that came in which is cool.

[0:14:48.1] DA: Cool, yeah. You got your headphones, you got your app, you got your buddy who is helping you out and you’ve planned it out pretty good. I mean, it sounds like we’re going to do all right, we’re going to make it through without too much context switching.

[0:15:01.9] MN: Yeah, hope for the best and you know, you got your tools now that will help you finish that particular story on the project you’re on and kind of lower the amount of context switching that happens. The role as you mentioned before in the article, rule of thumb, you lose 20% per project and the second project so don’t have more than five. Just give you a heads up.

[0:15:26.8] DA: Game over. You continue.

[0:15:32.2] MN: Yes, exactly, you’re going to want up, just don’t, yeah, just don’t get more than five. More than five will definitely crush you. Cool, yeah.

[0:15:42.0] DA: Do we have any teach and learns today?

[0:15:43.2] MN: Yeah, I have one I wanted to share, I’ve been working in React for some time and it’s been a while since I’ve had to use a ref in react, a reference and they made the change so that you should not use a string to identify a reference but you use a function instead where the callback that gets passed in, the variable that gets passed in is the element itself or of the component or whatever you’re getting the reference of.

Then you can attach the element to a variable of the parent component in which you have the callback for that function.

[0:16:25.6] DA: The parent element is responsible for tying these two children together in some way?

[0:16:31.9] MN: Yeah, let’s say you have like – let me think of an example, let’s say you have a cards component that has a list of cards, a list of card, single component. You can pass in a ref to the card component where the function is a callback that gets called on cards and then you can then take that variable, map it to the cards component and then be able to reference that component later on in life.

That might have been a bad example because you have to – if you iterate more than one card then you have to figure out how you’re going to reference each one. But you can – the way you do it now is not by using strings anymore and then doing this that like refs that string is not a thing you do. You just don’t reference. You don’t use the refs object anymore. In react, you just call it the function that you named in the variable that you want.

[0:17:26.4] DA: Is this React 16?

[0:17:27.7] MN: I think this was in react 15 but I haven’t used refs since so long that when I looked it up, I kind of felt bad. God, I’m using strings, what am I?

[0:17:39.4] DA: Is that something you have to do every day like –

[0:17:42.4] MN: Yeah, you normally user for like, when you want to capture a particular component for whatever reason later on in life, you want to either validate that component or like, try to get the dom element of that component to do –

[0:17:54.9] DA: Like to do like a scroll or something like that?

[0:17:56.6] MN: Yeah, just scroll into view and to a particular part of the application. You can find that component and then use it to your liking. You don’t normally use refs. I don’t think refs actually add a performance hit either but you only use refs when you need to which is not often.

[0:18:16.1] DA: Yeah. I’m actually thinking of a time that I could be using it right now. I learned something.

[0:18:23.0] MN: Dope, I’m glad you did because ref are dope definitely, get reffing. Cool. Dave, thanks for jumping on down and context switching with me throughout the entire evening.

[0:18:38.3] DA: So many Doritos.

[0:18:40.7] MN: Way too much Doritos. Cool, feel free to hit us up, twitter.com/radiofreerabbit. I’m Michael Nunez and this is the rabbit hole, we’ll see you next time.

Links and Resources:

The Rabbit Hole on Twitter



Java Script