Pair programming with beginners
Recently I've been helping out with a community introduction to coding workshop.
Pair programming is a great way to help people improve their programming skills.
By having someone else look over your work you get a chance to have an outside observer help you see new things.
When someone is completely new to programming using pair programming can greatly help them learn. It is however quite different to pair programming with someone who is more experienced.
What you didn't know you didn't know
One of the biggest benefits of pair programming with a beginner is helping them become aware of useful things that they didn't know they didn't know about.
For example a few years ago I was working with someone in Canada and I saw them type out some really long command line commands.
mv this_is_a_really_long_filename this_directory_is_also_really_long/
I saw them typing this character by character so I said "why aren't you using tab completion?" (https://en.wikipedia.org/wiki/Command-line_completion)
To which they replied "what's that?"
I got them to type the first few characters this_is_a_ then press tab, at which point the rest of the filename appeared on the screen. I got them to do the same for the directory name.
The were very happy to find out about this, it's not something that they knew about and also isn't the sort of thing that you would know to search for.
Anything that is both useful and hard to search for are the types of situations that pair programming is extremely good for.
One of the biggest things beginners are missing with programming is a mental model of how the code they are writing runs. Understanding the model of execution is one of the key moments in progression of a programming where they are no longer a complete beginner.
There was a good talk about this at PyCon Australia 2018 called "Running python on your brain computer" https://www.youtube.com/watch?v=3elWlN0MzGw
By showing people how the code will be run exactly you allow a large number of false assumptions and mismatches to be exposed quickly. Programming is very exacting, the code you write will run exactly as it is written and not "how it should run". (Incidentally this is part of why it's hard for developers to debug their own work, the focus shift from how things exactly are to how they should be is not an easy one) A gap between how things actually run and how they are assumed to run causes much frustration for beginners. Giving people the conceptual tools to understand how the code executes can remove a substantial amount of frustration.
One of my favorite ways to help people get a better sense of how the code runs is to use a visual tool that can execute the code in a step by step manner. One such tool is called PythonTutor https://pythontutor.com/
You can also use a debugging tool such as GDB or PDB or whatever debugger your language supports to enable step-by-step traversal of the code.
Tips for working with beginners
I think one of the biggest things is to make sure there's a safe learning environment. Learning something for the very first time can be intimidating, make it clear that mistakes are not only OK but are to be expected from a beginner. When people feel comfortable with the learning environment they will learn far better. Here's a few other miscellaneous tips:
- Try to keep things highly interactive and try to keep a cap on the amount of extra complexity being introduced at any one time.
- Keep in mind that the person you are pairing with is less experienced, give them enough space
- Let people make (recoverable) mistakes, much of the best learning in software engineering is learning how to fix mistakes and how to make systems that minimize the chances for mistakes to occur. one of the best ways to allow people to learn these skills is to let them make small mistakes and then show them how to recover. It's important from a learning perspective that these mistakes won't cause damage (for example production systems) since the pressure that is introduced when serious consequences exist for making mistakes is not a beginner friendly activity and will get in the way of effective learning.
- If you are at the keyboard go about things the way you usually do but make it clear you'd like to go over some of the things that the person you are pairing with is unfamiliar with. This can be a highly effective way for people to pick up smaller pieces of good info. For example when I was working with someone recently on a windows 10 machine I saw them tile some windows using a keyboard shortcut, I had a chance to ask how they did that and they told me (press windows key with arrow keys). Create these opportunities to transfer practical knowledge. For smaller pieces of info like the tab completion or keyboard shortcuts you can cover these immediately, if bigger topics come up take notes, these notes are incredibly valuable for the learning process.