+353-1-416-8900REST OF WORLD
+44-20-3973-8888REST OF WORLD
1-917-300-0470EAST COAST U.S
1-800-526-8630U.S. (TOLL FREE)

Programming with GitHub Copilot. Write Better Code--Faster!. Edition No. 1. Tech Today

  • Book

  • 336 Pages
  • July 2024
  • John Wiley and Sons Ltd
  • ID: 5952382
Accelerate your programming with the most popular AI coding tool on the market: GitHub Copilot

In Programming with GitHub Copilot: Write Better Code - Faster, veteran software developer and GitHub community hero Kurt Dowswell delivers an insightful and hands-on exploration of GitHub's powerful, new AI coding assistant, Copilot. In the book, you'll discover how to use the tool's capabilities to push the boundaries of what you thought was possible in programming.

Even if you've used autocomplete tools - like VS Code's TabNine extension - before, you'll be floored by GitHub Copilot's potential to transform the way you code. You'll learn how to install, configure, and use the software, from employing it's most common and widely used features to deploying business and enterprise functionality. You'll even discover how to fix runtime and compilation bugs and write unit, integration, and end-to-end tests.

You'll also find: - Prompt strategies to get GitHub Copilot to help you brainstorm new code solutions - What the future looks like for AI-assisted coding, including discussions of issues like code licensing and ethics - Directions for chatting with Copilot, including common commands and prompts to help you guide the conversation to where you want it to go

Perfect for practicing programmers, developers, and software engineers, Programming with GitHub Copilot is also an essential resource for coders and other IT practitioners-in-training who want to expand their knowledge and improve the scope and depth of their programming skillsets.

Table of Contents

Introduction xvii

Part I Getting Started with GitHub Copilot 1

Chapter 1 Get Started with GitHub Copilot 3

Learn Why GitHub Copilot Matters 4

Create a GitHub Account 4

Acquire a GitHub Copilot License 4

Install an IDE Extension 5

First Run: Test Copilot 10

Conclusion 15

Reference 15

Chapter 2 Decoding GitHub Copilot 17

Uncover the AI Behind GitHub Copilot 17

Understand Security, Privacy, and Data Handling 18

Understand Copyright Protections 20

Explore the GitHub Copilot Trust Center 21

Conclusion 22

References 22

Part II GitHub Copilot Features in Action 23

Chapter 3 Exploring Code Completions 25

Introducing Code Completions 25

Working with Copilot Code Completions 26

Discovering the Toolbar and Panel 34

Updating Copilot Settings 36

Leveraging Keyboard Shortcuts 38

Conclusion 40

Chapter 4 Chatting with GitHub Copilot 41

Discovering Copilot Chat 41

Defining Prompt Engineering with Copilot Chat 48

Commanding Your Conversation with Precision 52

Conclusion 65

Part III Practical Applications of GitHub Copilot 67

Chapter 5 Learning a New Programming Language 69

Introducing Language Education with Copilot 70

Setting Up Your Development Environment 70

Learning the Basics 72

Creating a Console Application 74

Explaining Code with Copilot 77

Adding New Code 78

Learning to Test 79

Conclusion 85

Reference 86

Chapter 6 Writing Tests with Copilot 87

Establishing the Example Project 87

Adding Unit Tests to Existing Code 89

Exploring Behavior-Driven Development with Copilot 94

Conclusion 99

Chapter 7 Diagnosing and Resolving Bugs 101

Establishing the Example Project 101

Fixing Syntax Errors 103

Resolving Runtime Exceptions 105

Resolving Terminal Errors 109

Conclusion 111

Chapter 8 Code Refactoring with Copilot 113

Introducing Code Refactoring with Copilot 113

Establishing the Example Project 114

Refactoring Duplicate Code 116

Refactoring Validators 122

Refactoring Bad Variable Names 127

Documenting and Commenting Code 129

Conclusion 132

Chapter 9 Enhancing Code Security 133

Detailing Code Security 133

Establishing the Example Project 134

Exploring Code Security 135

Finding and Fixing Security Issues 139

Conclusion 142

Chapter 10 Accelerating DevSecOps Practices 143

Detailing DevSecOps 143

Simplifying Containers 144

Automating Infrastructure as Code 148

Streamlining CI/CD Pipelines 152             

Conclusion 158

Chapter 11 Enhancing Development Environments with Copilot 159

Amplifying Visual Studio with Copilot 159

Elevating Azure Data Studio with Copilot 166

Boosting JetBrains IntelliJ IDEA with Copilot 171

Enhancing Neovim with Copilot 176

Consulting Copilot in the GitHub cli 181

References 185

Conclusion 185

Chapter 12 Universal Conversion with GitHub Copilot 187

Translating Natural Language to Programming Languages 188

Converting JavaScript Components 190

Simplifying CSS Styles 191

Enhancing Nontyped Languages with Types 196

Transitioning Between Frameworks and Libraries 199

Converting Object-Oriented Languages 203

Migrating Databases 205

Transitioning CI/CD Platforms 206

Modernizing Legacy Systems 209

Conclusion 213

Reference 214

Part IV Key Insights and Advanced Use Cases for GitHub Copilot 215

Chapter 13 Considering Responsible AI with GitHub Copilot 217

Introducing Responsible AI 217

Examining How Copilot Implements Responsible AI 218

Programming with AI Responsibly 226

Conclusion 226

References 227

Chapter 14 Augmenting the Software Development Life Cycle with GitHub Copilot 229

Introducing the SDLC 229

Assessing the Adoption of AI in the SDLC 231

Detailing Levels of AI Integration in the SDLC 232

Showcasing GitHub Copilot in the SDLC 238

Addressing Concerns: AI Adoption and the Future of Work 250

Conclusion 251

References 251

Chapter 15 Exploring Copilot Business and Enterprise 253

Introducing Copilot Business and Enterprise 254

Chatting with Copilot in GitHub.com 257

Indexing Code Repositories to Improve Copilot’s Understanding 262

Getting Better Answers with the Knowledge Base 267

Leveraging Copilot Chat in Code Repository Files 273

Enhancing Pull Requests with Copilot 279

Managing GitHub Copilot 288

Looking Ahead 292

Conclusion 293

References 293

Conclusion 295

Appendix Resources for Further Learning 297

GitHub Copilot Overview and Subscription Plans 297

Community Engagement and Support 299

Legal and Ethical Considerations 299

Research and Insights 300

Glossary 303

Index 311

Authors

Kurt Dowswell U.S. Department of Defense.