Pair Programming

Johnnie Gonzalez
5 min readSep 30, 2020

--

As programmers you might have already heard that we’re pretty “lazy”. The ideal coding session would consist of as little amount of lines of code as possible. We’ve implemented this way of “lazy” into how we code and when it’s appropriate. Sure you can write 1000 lines of code and it would work, but you could probably cut that in half. With it still producing the same outcome. These methods include helper methods, SQLite, Active Record amongst many, as well as Pair Programming!

Pair programming is when two people come together in order to successfully complete the task at hand. Usually a project. Either given by their boss or like me given by their instructor at Flatiron Academy as a Software Engineering student….loud and proud! 🗣🎉

You might think to yourself “What?”, “How?”, and “Why?”. Well first and foremost the “Why” is answered above and we will definitely go through the pros of pair programming soon enough. The “How?” is where we take a trip into paired programming.

A week into my first Module, within the program, pair programming was definitely something they just threw us into. You had to both jump on a zoom call together discussing the project’s deliverables(tasks). From there we had to start coding together. There are two ways to do this through from my current experience at Flatiron. In person and remotely.

Most likely you and your partner will have “Github” accounts. Being the both of you do (hopefully) have accounts one of you will create a repository for the project. This will contain all the files within your project. The current owner of the repository can add a “Collaborator” through the repositories settings under the “Manage access” column.

Under repository settings in our Github account
Add your partners Github name to send them an invite

This way the both of you can work on the same project BUT on different branches → In your terminal “git checkout -b branchname” will make a new branch and cross your over into it as well.

During each session after making changes you would need to input into your terminal “git status” to see what changes have been made. The “git add .” to save all those changes. Preferably every 15 minutes during each session “git commit -m “description””. This prevents any confusion about what changes were made to your partner. When you come to the end of your session you will have to “git push”. This pushes your work on the branch you are working on into Github. This way your collaborator can clone your repository and clone it to their computer and run “ git pull “branch_name” ” to retrieve the new work done by your partner. The process repeats itself back and forth. This can seem kind of tedious, but it’s not bad when you both have different schedules. Forcing the both of you to work at different times.

Now I know we did mention “lazy” being a programmers niche. So this comes to another paired programming neat trick. Well I’d like to think of it as so 🤷🏻‍♂️😎 . Currently I’m using a text editor called “VSCode” within this application you can download “LiveShare”. What this does is share your VSCode editor with your partner so instead of all of that back and forth with “git push” and “git pull” you both can work on it all together in real-time. Both you and your partner will even be able to work on different files within the application at once. I would also suggest using zoom to verbally communicate at the same time too.

Now how do we do this? In your VSCode application click on the Extensions tab as seen below.

Type in “LiveShare” in the search bar and click install. Once installed within the extension itself you see a list of options.

They allow you to decide how you want to pair program in being able to read/write or just read along with you. Clicking so will start a collaboration session and automatically copy the link to your clipboard so you’re able to send it to your partner.

When your partner starts collaborating with you. Their name will show up under “Participants” as well as under “Recent Contacts”. The recent contacts will speed up the collaboration process so that you can easily add them without having to send them a link. Simply pressing the button as shown below that’s next to their name. . It’s magic!

Square with green arrow👆

They’ll have to accept the invitation through VSCode without having to leave the application. Two minds are better than one! Both parties can have their strengths and weaknesses and help one another understand the reasoning behind their logic. I cannot tell you how many times this has benefitted me and those I have worked with! 👇🏼

“You missed a colon bro!!” — Mamadou

It can be really fun because you learn so much while in the process cutting that time down in half to build the application. Which means fewer lines of code and new bonding between you and your partner! Win win!

As you can see pair programming can be beneficial as I’ve stated above. Giving you the chance to not only be “lazy”, but learning how to work with others. With the added bonus of learning to explain the logic behind your ideas, which is a huge plus in itself.

--

--

Johnnie Gonzalez

Software Engineering creative with background in architectural design. Love for sustainable design and tech!