6

Getting started with GitHub Copilot

 1 year ago
source link: https://www.thoughtworks.com/insights/blog/generative-ai/getting-started-with-github-copilot
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
in_banner_blogs.jpg

Getting started with GitHub Copilot

More and more developers across Thoughtworks and at our clients are using GitHub Copilot for coding assistance. We have an internal guidance document that we are continuously updating as people are reporting back with their learnings and pitfalls. This is a high-level summary of that guidance document, focussed on the minimum a developer should know when they are getting started with an in-line coding assistance tool like GitHub Copilot. 

We are also publishing a series of more detailed memos about our learnings with AI-assisted software delivery in general over on martinfowler.com.

in_com_co_pilot_1_2.jpg

Relatively straightforward or standard problems — repetitive, boilerplate, common logic like list processing, a repeating pattern, things you’d usually copy & paste.

in_com_co_pilot_2_2.jpg

Commonplace languages and frameworks.

in_com_co_pilot_3_2.jpg

Tasks you know how to do in theory, but you need assistance with the details. You should know enough to judge if Copilot’s suggestions makes sense.

in_com_co_pilot_4_2.jpg

For small chunks: About 10-15 lines of code, maximum, so that you can follow along, and don’t increase your cognitive load with lots of code review.

in_50-50_co_pilot_getting%20started_mobile.jpg

Beware: Copilot can amplify “bad” local code

Getting stuck in older patterns
After refactoring, or introducing new patterns into the codebase, you might find that Copilot is still stuck in “the old ways”.

Proliferating bad practices
Copilot uses our existing code to make more suitable suggestions for our context, but depending on what it chooses as its example, it creates either the good or the bad kind of consistency. 

in_side-by-side_co_pilot_move_on_2.jpg
Move on

Don’t spend too much time fixing things if the suggestions are obviously not useful. Two strikes and move on! 

in_side-by-side_co_pilot_review_fatigue_2.jpg
Review fatigue

The larger the piece of code generated, the more code review you will have to do! Consider the balance between the “typing” boost and the energy needed for review. 

in_side-by-side_co_pilot_prompt_abstraction_2.jpg
Prompt abstraction

If prompting takes more time than coding itself, consider if it’s a good use case for Copilot, or if you should discard the assistance and write the code yourself. 

in_com_co_pilot_automation_bias_2.jpg

Automation bias

Once you have had some success with Copilot, be careful not to start over-trusting it. 

in_com_co_pilot_sunk_cost_fallacy_2.jpg

Sunk cost fallacy

Even though with Copilot, we did not invest time to write a suggestion ourself, we might still get over-attached to the supposed time saved of a multi-line suggestion. 

in_com_co_pilot_anchoring_bias_2.jpg

Anchoring bias

Be aware that once you have seen Copilot’s suggestions, you might have a harder time thinking about other solutions. 

in_com_co_pilot_security_vigilance_2.jpg

Security vigilance

Copilot does some pre-filtering for vulnerable patterns, but you cannot rely on the code to be secure for your context. Especially watch out for hallucinated dependency names. 


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK