liveBook · Manning

Chapter 2: First steps with AI-assisted coding

What you will learn in chapter 2 of Coding with AI

The chapter introduction recommends starting with generative AI coding tools by choosing one and experimenting.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction recommends starting with generative AI coding tools by choosing one and experimenting.

Key terms: generative AI tools, experiment, learning curve

2.1 What is GitHub Copilot?

This section introduces GitHub Copilot as a coding assistant, explains what it can suggest, and sketches how its trained model and editor service produce suggestions.

Key terms: GitHub Copilot, code suggestions, rubber duck, OpenAI Codex model, public source code, training, Copilot service, context, suggestions, feedback

2.1.1 How GitHub Copilot works

This section traces how GitHub Copilot turns editor context into code suggestions and filters those suggestions on their way back to the IDE.

Key terms: prompt, context, fill-in-the-middle (FIM), inbound flow, proxy server, toxicity filter, LLM model, outbound flow, code quality, security

2.1.2 Interacting with GitHub Copilot

This section shows how developers can use GitHub Copilot in the editor and chat window to generate, transform, debug, and document code.

Key terms: code completion, code generation, hints, async def, translation, debugging, documentation generation, right-click, chat window, project

2.2 Common patterns

This section gives reusable chat requests for diagnosing, understanding, improving, generating, and evaluating code with AI coding tools.

Key terms: selected code, diagnose, legacy code, refactor, security, speed, resource usage, readability, maintainability, specific task

2.3 Context is everything

This section explains how coding assistants use project context, including code around the cursor, to make suggestions that fit existing code.

Key terms: context, workspace, repository-level context, IDE integration, fill-in-the-middle, FIM, cursor

2.4 What is NLP?

The section introduces natural language processing, then explains how tokenization and word-pattern analysis help computers work with human language.

Key terms: natural language processing, NLP, sentiment analysis, machine translation, text summarization, tokenization, tokens, word-based tokenization, word frequency, word types

2.5 A simple Python project

This section defines a Copilot-assisted Python project that finds the most frequent words in a text file and displays them in a bar chart.

Key terms: word frequency, top N, bar chart, lowercase, punctuation, word count, tokenization, token

2.5.1 Preparing your development environment

This section sets up a folder in VS Code, identifies the workspace areas used during development, and reviews ways to interact with Copilot.

Key terms: Open Folder, New Terminal, terminal, side bar, activity bar, Copilot Chat, terminal window, editor window, comment, code completion

2.5.2 Creating the application

The section sets up an isolated Python project and demonstrates ways to use, compare, and review Copilot suggestions while building functions to read and clean a text file.

Key terms: Python virtual environment, packages, libraries, code completion, Copilot Chat, refactor, generated code, encoding, manual intervention, comment

2.5.3 Side quest: Testing the function speed

The section tests Copilot-generated text-cleaning functions, then completes a word-frequency script that displays its results as a bar chart.

Key terms: Copilot, testing, profiling, clean_text2, tokenize, unique word, frequency, comment prompt, Defaultdict(), Matplotlib

2.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 1: Introducing generative AI Chapter 3: Design and discovery →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.