Article  |  Internship

Context Switching Between Languages, Projects, and Problems

Reading time: ~ 3 minutes

Context Switching Between Languages, Projects, and Problems

Interning at a development agency like Planet Argon has meant that I might go from an app using Rails 5.1.6 to one using Rails 3.2.2 to a React front end all in the same day. It can be disorienting and sometimes leaves me feeling like I’ve lost all knowledge of programming languages, frameworks, and life in general. I sometimes find myself staring blankly at the screen until I suddenly think, wait, what am I doing?

As a junior developer, it’s easy for me to think that when things are hard, it’s because I’m still new. But I’ve learned it’s not just me. Everyone has a hard time shifting their mental energy. And while switching between languages or versions may be extreme, shifting between different problems in the same application or even the same problem in the same app after a few weeks or months have passed can have the same disorienting effect.

Along the way, I’ve learned a few lessons to make these transitions less painful that I hope can help others, too.

Take notes as you work

I know it seems obvious, but taking notes can save a lot of time in the long run. Even as I recognize this is important, I’m not great at consistently doing it because it’s hard to make notes a priority when you’re trying to push out a feature or fix a critical issue.

But here are the reasons I wish I did it more:

  • Taking notes helps you track what you’ve already tried so you don’t repeat yourself troubleshooting; additionally, when asking for help you can efficiently share the steps you’ve already taken, so you can get to a solution more quickly.
  • Good notes can give you a quick reference for questions you’ve already asked (and their answers), and any helpful resources you discovered along the way – instead of having to Google answers again.
  • Beyond just helping yourself, taking notes helps others dive into the problem more quickly, especially when you share your notes in a public place like within a job ticket. Don’t assume others, even more senior developers, have some special ability to immediately understand and fix a problem.

Try snippets of code in the console

Especially when you’re shifting between languages, trying out small solutions or pieces of code helps you get back into the language. The other day I was pairing with another developer on a form validation feature for a project with a Rails backend and a React frontend.

We wanted to validate the data in Rails and display the validation errors in the form component on the React side. So, we were switching between Ruby/Rails and Javascript/React regularly. When you’re doing that, it can be hard to remember even basic things like the Javascript method to add something to an array.

Is it .push? No, that’s Ruby. No, wait, that’s Javascript, too.

Using the Javascript console and IRB to quickly test out code helped us to more rapidly get into the headspace of each language, get immediate feedback, isolate problems, and more confidently implement new code into the project.

Check your git log and specific file changes

I’ve found that while orienting myself in a problem or project, it can be really useful to quickly review what’s been done recently in both the project and in the specific files you’re working in.

These commands have come in handy:

  • $ git log --oneline lets you see just the commit messages on a project. Remove --oneline to see more details about each commit.
  • $ git log --pretty=oneline --graph --decorate --all lets you visualize the version tree.
  • $ git log -- <file_name> shows the latest commits for a specific file. Replace with your file (e.g. $ git log -- app/controllers/application_controller.rb)
  • $ git log -p -- <file_name> shows you the differences between each commit for a specific file.
  • git diff master:<file_name> <file_name> lets you compare a specific file on your feature branch to the current master to see what changes have been made on your branch.

Know that it takes time

I think these tips can help, and I think with more experience it becomes easier to shift between different contexts. But ultimately, I have to remind myself that it’s ok that it takes a little time.

For me, knowing that context switching takes time makes it easier to have realistic expectations for what I can accomplish and to more accurately estimate how long a project will take. It also helps me structure my time to focus on the same project or problem for larger chunks of time to decrease the amount of time I spend switching between projects.

Kristin Brewer-Lowe is a spring intern at Planet Argon specializing in Rails/React.js. You can learn more about Kristin by connecting on LinkedIn or checking out her work on Github.

Have a project that needs help?