Talks

Policing and Pairing: An Unlikely Preparation

Policing and Pairing: An Unlikely Preparation

by Dan Quan

In the talk titled "Policing and Pairing: An Unlikely Preparation," Dan Quan reflects on how his experience as a police officer has influenced his approach to pair programming as a developer at Braintree. He emphasizes that pairing can be intimidating but offers significant advantages, such as improving new developers' ramp-up time and enhancing problem-solving capabilities. Key points include:

  • Pair Programming Practice: At Braintree, pair programming is standard, involving two developers using a single machine. The practice encourages collaboration and communication, which are also critical skills evaluated during the hiring process.
  • Tools and Techniques: The company utilizes various tools to manage the pairing process effectively, including VMs, Vim, and Tmux. The transition to virtual environments has facilitated easier collaboration, despite challenges for newcomers in adapting to these tools.
  • Learning from Policing: Dan compares the training of police officers with onboarding developers, suggesting that the focus should be on showing and allowing mistakes in both fields. He shares insights from his police training experiences that influenced his training approach to new developers.
  • Communication in Pairing: Dan discusses the importance of dividing responsibilities during pair programming and maintaining open lines of communication, drawing parallels to his experiences as a cop where team coordination was vital during high-pressure situations.
  • Overcoming Tunnel Vision: He warns against tunnel vision in both policing and programming, advocating for the benefits of pairing to maintain awareness and avoid critical oversights.
  • Community and Trust: The sense of community and open feedback is highlighted as a major difference between his past and current roles, emphasizing the importance of trust and collaboration in achieving quality outcomes in coding.

Dan concludes by encouraging developers to leverage pairing as a means to ensure code quality, emphasizing that collaboration not only boosts performance but also fosters a healthy team environment. His unique perspective provides valuable insights into how the principles of pairing can be applied by drawing on experiences from policing, ultimately enhancing the work culture at Braintree.

00:00:24.680 My name is Dan Quan, and I'm going to be talking today about how my experience as a cop helped me pair program. I'm also going to discuss the tools and techniques Braintree uses to establish a culture of pairing. I've been a developer at Braintree for almost two years. Prior to that, I was an attorney, and I also worked as a cop in Baltimore City. I actually became a cop after law school because I wanted to experience the excitement of being involved in helping people. Looking back, the Peace Corps would have probably been a better alternative.
00:00:41.520 What I ended up encountering were many objectionable and unconstitutional practices, which we see every day in the news now. I noticed a warrior and gladiator culture—rather than a culture of servitude to justice. As a result, I found myself becoming angrier and more violent, which ultimately led me to leave. I then learned programming and got a job at Braintree, where my experience working with a partner helped me excel.
00:01:17.479 This is not a talk on the benefits and consequences of pairing, nor is it an encouragement for anyone to pair. However, I will say that pairing is pretty great. It is an excellent way to ramp up new developers, solve tough problems, and spread domain knowledge. That said, pairing can also be intimidating as it requires you to spend seven or so hours a day talking to and directly working with another person, which can be scary. Many people worry it will slow them down or that it will slow down their entire team.
00:01:43.200 Finding a good balance on how often you should pair can be challenging. Additionally, there can be logistical hurdles as your team grows and becomes more distributed. To me, pairing involves two people working together on the same machine—whether it’s locally or in the cloud—using two different keyboards and two different monitors to solve a hard problem. At Braintree, we practice ping-pong pairing, where person A writes a failing test, and then switches with person B, who writes the code to make that test pass.
00:02:18.400 This process continues with person B writing the next failing test and person A switching back to write the code that makes that test pass. Pair programming is a default practice in Braintree, although smaller teams are free to decide not to pair or to pair less often. We value communication skills just as much as technical skills during our interview process, and our tools are built around pairing.
00:02:45.120 We use VMs managed on infrastructure dedicated to pairing. Vim is a terminal text editor, and Tmux is an application that allows you to share terminal sessions. Initially, we paired using Mac Pros with two different monitors and two keyboards, but this setup became cumbersome as our team scaled. Our infrastructure team decided to provision virtual machines and we SSH directly into them.
00:03:01.959 We now have a standardized development environment in which we all use the same configuration and key bindings. This setup provides a low-latency, convenient way of collaboration. However, Vim and Tmux have some drawbacks; they aren’t the easiest tools to pick up, which can lead to a productivity loss as new people need to learn them.
00:03:29.600 Moreover, you cannot browse online documents together or search Stack Overflow collaboratively. While Vim is great for Ruby, transitioning to languages like Java can be challenging. To tackle these drawbacks, my team, which has recently been writing a considerable amount of Java, has been using a mixture of VNC, IntelliJ, and Tmux on machines in AWS. Despite some frustrating latencies in VNC, this combination has been working well for us. I believe it's crucial to find what works for your team and to iterate continuously on that.
00:04:14.560 Now, police officers are often paired for safety, much like the reasons developers pair. Most patrol officers in Baltimore are not paired, but during my time there, I was part of various units that encouraged collaboration. Admittedly, the training for police in Baltimore isn’t the best, but there are some core concepts worth discussing. Field training follows a six-month police academy, and for anyone considering this career path, it's a grueling process balancing an intense schedule.
00:05:10.080 Onboarding, whether for a cop or a developer, involves teaching by showing and allowing room for making mistakes. There's a common trope where a rookie cop joins a veteran, and the veteran tells them to forget everything they learned because field training is different. You are assigned a primary field training officer for a 12-week period, starting with them observing you and transitioning into you being evaluated by them. This experience resembles a formalized apprenticeship, though the quality of training can vary significantly depending on the officer.
00:06:03.880 There were officers who genuinely cared about training newcomers, but others participated solely for the extra pay and offloading their paperwork onto their trainees. I learned valuable lessons during my officer training, and I've tried to apply that to onboarding new developers. Pairing is excellent for onboarding; starting a new job or entering an entirely new field can be quite challenging.
00:06:39.799 My experience at Braintree was just seven months before I found myself training a group of new developers. I aimed to strike that balance of showing while also encouraging self-sufficiency, thus evaluating and giving constructive feedback. This approach, I believe, worked well and was informed by my own past experiences with field training.
00:07:18.120 Alright, what would a talk on policing be without a story about a car chase? I was a relatively new cop when I found myself in my first chase. My partner and I responded to a burglary, where I saw someone carrying a large object who then dropped it and sprinted to his car. The chase lasted about 12 minutes, which is significantly long for a police pursuit.
00:07:48.600 Typically, 70% of chases that end in a collision do so within the first six minutes. As I was driving, I had to ensure I wasn’t endangering anyone else, nor forcing the suspect to jeopardize others. My partner needed to constantly communicate our location and respond to our dispatch and supervisors. While we were the primary officers, my partner had to coordinate with Baltimore County officers as the chase crossed jurisdictions.
00:08:14.440 Throughout the chase, we also had to manage our tunnel vision—a phenomenon where you become so fixated on one task that you lose sight of everything else. Despite it being over three years ago, I still vividly remember the driving aspect of it, but I can't recall much of what my partner was saying over the radio. Driving was probably what I miss most about being a cop; however, doing so responsibly posed a significant challenge.
00:08:57.920 Despite these challenges, my partner and I managed a responsible and relatively safe chase because we divided labor. I focused on driving, while my partner handled communication, and we each used our judgment to determine if the chase was safe to continue. Ultimately, the chase ended with a collision shortly after another jurisdiction took over, when one of their officers collided with an electrical post.
00:09:40.200 I think pairing is best when you split responsibilities; I believe everyone recognizes that while your pair is working, you shouldn’t check Slack or email. But communication is essential during those exceptions. A common pitfall in pairing is the urge to act like a compiler, pointing out small mistakes like a misspelled variable—this often stems from a desire to help. However, it’s more beneficial to provide feedback on their design choices and highlight potential pitfalls after tests have passed.
00:10:05.240 Importantly, dividing labor also means considering how your paired solution fits into the larger context of what you are aiming to achieve. Earlier, I mentioned tunnel vision, and pairing can be a great way to avoid it—provided both parties remain vigilant against it, otherwise, you risk having two instances of tunnel vision instead of one. I've noticed this issue in a few operations going wrong in production, which can be nearly as anxiety-inducing as a car chase.
00:10:46.999 Being an introvert, my role as a police officer required extensive communication, whether with my partner, members of the community, or criminals and other officers for sometimes up to 14 hours a day. The biggest challenge was finding a balance that worked for me, including taking regular breaks to recharge. Good communication was critical; for instance, my partner once informed me he was distracted due to personal issues. Knowing this, I adjusted my approach accordingly.
00:11:29.520 I think breaks and communication are equally important for developers. Breaks can enhance productivity and are crucial for maintaining one’s well-being. For me, the Pomodoro Technique—working in 25-minute intervals—has been excellent as it's systematic and allows me to articulate my distractions.
00:12:05.840 Being mindful of personal challenges and communicating openly with your pair can make a significant difference in collaboration. It's a small gesture, but it means a lot. I bring this up towards the conclusion because, while safety and code quality are vital, they aren't the primary reasons to pair.
00:12:35.840 Earlier, I mentioned that in Baltimore City, it was common not to have a partner, and in those instances, safety comes from having numerous officers nearby. Backup is always a radio call away; in fact, 'signal 13' signifies that assistance is on the way quickly. One night, I was waiting for my partner when I witnessed a collision, and fortunately, I was able to assist.
00:13:13.440 This incident helped me gain the reputation of being someone who chases down cars on foot. Running up to the vehicle, I noticed a Marine Corps sticker and a large, intoxicated man emerging from the car with a baseball bat. I had been broadcasting my location over the radio, so backup was on its way. However, during that critical minute, I had to rely on my communication skills to de-escalate the situation.
00:14:12.000 Had my partner been there with me at that moment, the circumstances would have been significantly safer and less stressful. We all care about code quality, and pairing is one method to ensure it. Code reviews and pull requests are also effective ways of maintaining quality. Nonetheless, regardless of whether you partner frequently, recognize those tricky moments in programming and do not hesitate to bring someone else in if necessary.
00:15:00.000 Trust and communication with your team are essential; these elements are inherent to pairing and necessary for its effectiveness. Throughout my time in the police force, I picked up some bad habits that were difficult to shake off. I'm not referencing driving a little too quickly but rather a culture problem underscored by a 'thin blue line,' where officers feel pressured not to speak out against each other.
00:15:51.000 While some officers showed genuine courage by reporting wrongdoing, the consensus in the district was often negative, creating a dangerous environment for all. As a new developer at Braintree, I had a coworker who effectively stopped contributing for a month. My team covered for him, but I didn’t address the situation with my manager or that person due to this ingrained mentality. I regret this inaction because providing feedback is vital to growth.
00:16:45.120 Many people often ask me about the most significant differences between my past life and my current one. While the difference in salary is notable, it’s not what stands out to me. Instead, it’s the sense of community and how welcoming and open you all are. Thank you for that, and thank you for listening. Feel free to reach out if you have any questions.
00:17:13.000 Does anyone have questions?
00:17:15.000 Is there a hand? The lights are bright.
00:17:20.000 Yeah, the question was, what do I mean by tunnel vision? Tunnel vision is when you get so fixated on one aspect that you lose track of everything else.