Why use AI pair programmers?

I have been using Github Copilot for a few months now and have been blown away at how helpful it is when writing tests. These tools get a lot of bad rap, but I suggest you try them before you knock it. Tests are a great place to start.

Writing Tests for GeoAsteroids

I have this [2D spaceship game] I wrote in Typescript. It didn't have any tests, so I thought it would be an excellent place to try Copilot. 

Test moveShip

The following function fires whenever the user presses the up arrow on their keyboard.

/**
 * Move ship based on its x and y velocity
 */
function moveShip(ship: Ship): void {

  ship.centroid = new Point(
    ship.centroid.x + ship.xv,
    ship.centroid.y + ship.yv,
  );
}

Copilot cleverly suggests the following test without me typing anything! It's exactly what I was going to write anyway.

test.concurrent('Move Ship', () => {
  const testShip = new Ship();

  testShip.xv = 1;
  testShip.yv = 1;
  moveShip(testShip);
  expect(testShip.centroid.x).toBeGreaterThan(0);
  expect(testShip.centroid.y).toBeGreaterThan(0);
});

Conclusion

AI pair programmers are not perfect. Sometimes the suggestions are flat-out wrong, and I am always weary of mindlessly accepting the autocomplete. But tools like Copilot already deliver great value for low-hanging fruit like writing tests. I am excited to continue using it and look forward to Copilot taking more and more off my plate. This way, I can focus on the most creative aspects of programming (writing new features!).

Comments

Back to Home
John Solly Profile Picture
John Solly Profile Picture

John Solly

A hands-on AI practitioner who transitioned to a CTO role to broaden my impact.

Most of my career has been dedicated to developing spatial systems at Esri, startups, and federal agencies. Currently, I lead technology strategy for Leidos' Health IT division, supporting agencies such as SSA, VA, and HHS.

My primary focus is the convergence of spatial computing and AI, enabling machines to interpret the physical world and applying these capabilities to meaningful missions.

Please reach out if you are interested in spatial systems or advancing AI within the federal government.