GitHub Copilot: Your AI pair programmer – what is all the fuss about?

GitHub Copilot: Your AI pair programmer – what is all the fuss about?

Last week, GitHub publicly unveiled?Copilot, the preview of its "AI pair programmer," a code completion style tool designed to provide line or function suggestions in your IDE. It has certainly made waves in the world of programming and beyond, and you have likely heard at least something about it.

But Copilot is more than simple autocomplete and is more context aware than other code assistants. Powered by OpenAI's Codex AI system, Copilot contextualizes a situation using docstrings, function names, comments, and preceding code to best generate and suggest what it determines to be the most appropriate code. Copilot is designed to improve over time, "learning" from how developers use it.?

Trained on billions of lines of public code, GitHub Copilot puts the knowledge you need at your fingertips, saving you time and helping you stay focused.

Currently available for Visual Studio Code and platforms powered by a VS Code backend — such as GitHub's Codespaces — Copilot "understands" dozens of languages, with the technical preview being noted as doing "especially well for Python, JavaScript, TypeScript, Ruby, and Go." You can accept default code suggestions, cycle through additional proposals, modify the code you accept, or ignore Copilot suggestions at a particular point in your code altogether.

Some of the major selling points of Copilot, as evidenced by their highlighted inclusion on the Copilot website, include the following (taken directly from?the website):

  • Convert comments to code. Write a comment describing the logic you want, and let GitHub Copilot assemble the code for you.
  • Autofill for repetitive code. GitHub Copilot works great for quickly producing boilerplate and repetitive code patterns. Feed it a few examples and let it generate the rest!
  • Tests without the toil. Tests are the backbone of any robust software engineering project. Import a unit test package, and let GitHub Copilot suggest tests that match your implementation code.
  • Show me alternatives. Want to evaluate a few different approaches? GitHub Copilot can show you a list of solutions. Use the code as provided, or edit it to meet your needs.

No alt text provided for this image

How Copilot works (source)

?These are all impressive use cases and claims, and from the examples provided they are also impressive results. Here is an example of a prompt that Copilot has treated as context to generate code from, consisting of a combination of function name and verbose docstring:

import datetime

def parse_expenses(expenses_string):
    """Parse the list of expenses and return the list of triples (date, value, currency).
    Ignore lines starting with #.
    Parse the date using datetime.
    Example expenses_string:
        2016-01-02 -34.01 USD
        2016-01-03 2.59 DKK
        2016-01-03 -2.72 EUR
    """        

And here is the function that Copilot generates:

    expenses = []
    for line in expenses_string.splitlines():
        if line.startswith("#"):
            continue
        date, value, currency = line.split(" ")
        expenses.append((datetime.datetime.strptime(date, "%Y-%m-%d"),
                         float(value),
                         currency))
    return expenses        

That certainly functions as described.

I have applied for, but, as of publication time, have yet to been granted access to Copilot. Therefore, we will have to, unfortunately, rely on what we read elsewhere for our first impressions at this point.

More so than anything, I am excited about the "comments-to-code" context use case of Copilot, in particular as relates to function docstrings. As a good programmer, you should be writing (and I certainly do!) quality docstrings for your functions, after you have planned out what the function should do, and prior to implementing said function. With the use of Copilot, we should be able to devote more time to the planning and documenting steps, and perhaps skip much of the initial phase of the implementation step altogether, focusing instead on tweaking the generated code afterwards.

Here is another simple yet powerful example of a comment turned into a block of code (from?an analysis of Copilot on the GitHub documentation, something I encourage you to read):

I anticipate Copilot may change the way we write code to a large degree.

The Copilot page also has a number of testimonials, from GitHub and OpenAI devs who have been using the system for some time, and beyond. Here's a ringing endorsement from someone you may have heard of:?

In the first day, GitHub Copilot already taught me about a nuance in Javascript object comparison and is as comfortable with our database schema as I am. This is the single most mind-blowing application of ML I’ve ever seen.
— Mike Krieger // Co-founder, Instagram

Copilot thus far seems like a mightily impressive application of machine learning. Even more noteworthy, it is not something that is theoretical or impractical; Copilot is immediately useful and poised to have an actual impact on how coding is performed.

Trust me when I say that I am legitimately excited about getting my hands on Copilot, and promise to follow up with some observations from my own first-hand experiences once I do.

****************************

要查看或添加评论,请登录

Harsha Rao的更多文章

  • Beyond Technical Expertise: The True Reasons Why Software Developers Fail !

    Beyond Technical Expertise: The True Reasons Why Software Developers Fail !

    Jennifer with a geeky heart had always dreamed of being a software developer. From the time she was a young girl, she…

  • Work-Life Balance!

    Work-Life Balance!

    Life is like a Cycle. Not the circular motion, but I am referring to the ubiquitous bicycle.

  • RPA: A new wave in the business world

    RPA: A new wave in the business world

    Robotic Process Automation? You must have heard a lot about this growing technology. Well, a thought must be baking in…

  • The high’s and lows of Cryptocurrency

    The high’s and lows of Cryptocurrency

    Cryptocurrency! The term has gained hype dramatically in recent years. The recent rise of Bitcoin brings cryptocurrency…

  • Cloud computing: The power of innovation and technology

    Cloud computing: The power of innovation and technology

    Once Larry Ellison said, “Cloud computing is not only the future of computing but the present and entire past of…

  • Virtual surgery is Transforming Healthcare

    Virtual surgery is Transforming Healthcare

    Although virtual reality is most commonly associated with gaming, it is also gaining traction in other fields such as…

  • Healthcare Shakers, Shapers, and Movers

    Healthcare Shakers, Shapers, and Movers

    This conversion is a multi-step process rather than a single action. It's known as the "value agenda.

  • Great Management Myths

    Great Management Myths

    We all have preconceived notions about what it takes to be a successful leader and the qualities we assume leaders must…

  • Women leadership

    Women leadership

    Women symbolize power, love, compassion, and bravery. Women’s roles in today’s society have shifted dramatically for…

  • Era of Human-AI-Robots

    Era of Human-AI-Robots

    Artificial intelligence is affecting the future of almost every business and every human being. Artificial intelligence…

社区洞察

其他会员也浏览了