Customer Service 1-800-221-5528

AI-Assisted Programming with Copilot

by Scott McCoy and Mary Delamater
7 chapters, 224 pages, 149 illustrations
Published
ISBN 978-1-943873-23-4
List price: $39.50

This book is an ideal supplementary text for any programming course. That’s because an AI assistant like GitHub Copilot can help your students develop higher quality software faster than ever before. However, to do that, your students need to be able to read and write code so they can thoroughly review, test, debug, and improve the code that’s generated by AI.

So, you can start by teaching your students HTML/CSS, JavaScript, Python, SQL, or any other language. As you do this, you can use this book to show your students how they can use Copilot to empower them to be better software developers. This includes using Copilot to implement unit testing to thoroughly test the software, a skill that’s important when using AI to generate code. And it includes using Copilot to design and maintain software.

Our students always give feedback on their end-of-course evaluations that Murach textbooks are so well organized and easy to follow, with plenty of code examples, figures, and instructions."

Roger Fang, CIS Instructor
Arkansas Tech University, Russellville, Arkansas

  • About this Book
  • Table of Contents
  • FAQs
  • Corrections

Book description

To present the skills that your students need in a manageable progression, this book is divided into two sections.

Section 1: Get started fast

Section 1 dives right in and gets your students started fast with a two-chapter course in using Copilot to develop software. These chapters show how to:

  • Set up Copilot to work from within VS Code.
  • Create a Python program with Copilot.
  • Create a JavaScript web app with Copilot.
  • Master the essential skills for working with Copilot’s Chat window.
  • Use Copilot’s inline chat interface.
  • Follow the best practices for prompt engineering.

Section 2: More skills as you need them

After your students finish section 1, they’ll be ready to jump to any of the chapters in section 2. As a result, you can assign whichever chapters are relevant to your course. These chapters show how to use Copilot to:

  • Create a Python program that uses doctests to automate testing.
  • Create a website that uses responsive web design.
  • Generate SQL to work with an existing database or to create a new database.
  • Ask for advice about software design and requirements gathering.
  • Generate comments and documentation such as README.md files.
  • Implement robust unit testing for Python code with pytest.
  • Implement robust unit testing for JavaScript code with Jest.
  • Implement test-driven design (TDD).

What courses this book is designed to supplement

This book has been carefully designed to work as a supplement for any type of programming course. Here’s how our book can work for several common programming courses:

A Python course

After your course teaches basic Python coding skills, it can use section 1 of this book to show your students how to use Copilot to enhance those skills. Then, as you teach more Python skills, you can assign any of the chapters in section 2 that make sense for your course. For example, you can assign chapter 3 to present more Copilot skills for developing Python code. Or, you can assign chapter 7 to show how to use Copilot to implement robust unit testing with pytest.

A JavaScript course

After your course teaches the basic JavaScript skills, you can use section 1 of this book to show your students how to use Copilot to enhance those skills. Then, as you teach more JavaScript skills, you can assign any of the chapters in section 2 that make sense for your course. For example, you may want to assign chapter 7 to show how to use Copilot to implement robust unit testing with Jest.

An HTML/CSS course

Once your course teaches the basic HTML/CSS skills, you can use section 1 of this book to show your students how to use Copilot to generate code. Then, after you teach your students how responsive web design works, you can assign chapter 4 so your students can use Copilot to generate the HTML and CSS for a website that implements a responsive design.

A database course

Once your course teaches the basic skills for using SQL to work with a database, you can use section 1 of this book to show your students how to use Copilot to generate code. Then, you can assign chapter 5 to show how to use Copilot to generate SQL that works with an existing database or creates a new database.

Recommended software

All of the recommended software for this book is available for free, and chapter 1 provides complete, step-by-step instructions that your students can use to install it on their computers.

VS Code

To write code, your students need a code editor. This book shows how to use VS Code because it provides excellent tools for developing code in most languages including Python, JavaScript, HTML/CSS, and SQL. In addition, it provides an integrated way to use Copilot to edit code.

Python

To test Python code that’s generated by Copilot, your students need to have Python installed on their system.

Chrome

To test HTML, CSS, and JavaScript that’s generated by Copilot, your students need to have a web browser. This book shows how to use Google Chrome, but your students can use another web browser if they prefer.

DB Browser for SQLite

To work with a database, your students need a database that implements the SQL standard. This book shows how to use DB Browser to work with SQLite, an embedded database that implements the SQL standard and doesn’t require installing a database server like MySQL, SQL Server, or Oracle. However, if you’re students already have access to a database server, they can use the skills described in this book to work with a database on that server.

About the format

This book doesn’t use Murach’s unique paired-pages format. Instead, it uses a reflowable format because we think it works better for eBooks, and more than half of our customers now use eBooks. This new format retains as many elements of our paired-pages format as possible, but we have modified them to make them work with the reflowable format. If you have a chance, let us know what you think of this format.

About the instructor's materials

This book provides exercises at the end of each chapter, and we have not provided solutions to the exercises as part of the download for this book. As a result, you should be able to use the exercises at the end of each chapter as assignments. Due to the non-deterministic nature of AI, these solutions should be different for every student, but you should be able to evaluate each student’s solution on how well it completes the task assigned by the exercise.

Since this book is designed to be a supplementary text, we don’t currently plan to create the rest of our usual set of instructor’s materials for it (objectives, PowerPoint slides, and multiple-choice tests). But, if you’re planning on using this book as a supplement for your course, and some of these instructor’s materials would be helpful to you, please let us know which ones you’re interested in, and we’ll consider developing them.

Praise for Murach books

“This is my first exposure to Murach’s books, and I love them. I like the organization of the content, the consistent approach in each book, and the accuracy of the material.”
— Bob L., Michigan

“I can’t praise this book highly enough. The clarity used in picking what to include, when to introduce it, and how to do so is remarkable.”
— Charles Ferguson, Software Developer, Australia

“Another thing I like is the exercises at the end of each chapter. They’re a great way to reinforce the main points of each chapter and force you to get your hands dirty.”
— Hien Luu, SD Forum/Java SIG

“Your book was indispensable to me. The answers were right there at every turn. All the examples made sense, and they all worked!”
— Alan Vogt, ETL Consultant, Massachusetts

“This book covers the perfect amount of description, and it does not make you bored by providing unnecessary details.”
— Posted at an online bookseller

On Murach’s Python Programming: “This is now my third book for Python, and it is the ONLY one that has made me feel comfortable solving problems and reading code.”
— Posted at an online bookseller

“Your books shine out from the rest—the quality of writing and presentation of information is topnotch, and the consistency of quality across books is impressive.”
— Nolan Tamashiro, Developer

View the table of contents for this book in a PDF: Table of Contents (PDF)

Click on any chapter title to display or hide its content.

Section 1 Get started with Copilot

Chapter 1 Create two short programs

Background terms and concepts

Some important terms

An introduction to AI assistants

Four components of an AI assistant

How to set up your computer

Download the files for this book

Install VS Code

Enable Copilot

Install Python

Set up VS Code

How to create a web app

Generate the code

Test the code thoroughly

Improve the code

How to create a Python program

Generate the code

Test the code thoroughly

Improve the code

A review and a look forward

The prompts for the Python program

Problems with LLMs

Chapter 2 The essential skills for using Copilot

How to edit files

Use the Chat window in Ask mode

Use the Chat window in Edit mode

Use the Chat window in Agent mode

Use inline chat

Use comment prompts

How to choose which technique to use

How to use chat participants and slash commands

Use chat participants

Use slash commands

Best practices for prompt engineering

Be specific

Provide context

Specify output

Say what to do

Assign roles

Use structured formats

Types of prompts

Zero-shot

Few-shot

Prompt chaining

Chain of thought

More types of prompts

Section 2 More skills as you need them

Chapter 3 Create a Python program

How to use Python doctests with Copilot

How to add a doctest to a function

How to run doctests

How to use Copilot to write doctests

How to simulate user input or random numbers

Generate the initial code

Make a plan in the Chat window

Apply the code to the files

Run the program

Run the doctests

Improve the initial code

Add a graphical representation of a die

Format the player scores

Format the player turn

Refactor the code

Ask Copilot for advice

Convert from functions to objects

Run the program

Chapter 4 Create a website

Start the website

Examine the starting files

Create a directory structure

Develop the home page

Develop a speaker page

Refine the web pages

Fix the content for the home page

Refine the shared code

Refine the header

Fix two responsive design issues

Scale the images

Add a menu toggle for small screens

Refactor the website

Use nested styles

Add a submenu to the navbar

Add comments to HTML and CSS files

Chapter 5 Work with a database

How to work with SQLite

Install DB Browser for SQLite

Open a database and view its tables

Run SQL statements

Export a schema

Work with an existing database

Select data from a single table

Select data from multiple tables

Insert, update, and delete data

Create other types of queries

Create transactions

Create a new database

Generate a script that creates a database

Run the script and test the database

Chapter 6 Design and maintain software

How to design new software

Gather requirements

Make architectural decisions

Create a project structure

Address other planning issues

How to maintain existing software

Analyze existing code

Find and fix bugs

Find and fix security issues

Add comments

Create a README.md file

Chapter 7 Implement unit testing

An introduction to unit testing

How to unit test Python code

Install pytest

Generate some initial tests

Generate tests for edge cases and more

Troubleshoot failing tests

How to unit test JavaScript

Install Node.js

Install Jest

Generate some initial tests

Generate tests for edge cases and more

Troubleshoot failing tests

How to mock external dependencies

Mock a dependency in Python

Mock a dependency in JavaScript

How to use test-driven development (TDD)

Generate tests for non-existent code

Generate code that passes the tests

Refactor the code by generating more tests

We'll be posting answers to the frequently asked questions (FAQs) for this book here. So, if you have any questions, please send them to us by email. Thanks!

There are no book corrections that we know of at this time. But if you find any errors in this book, please send them to us by email, so we can post the corrections here. Thank you!

Murach college books and courseware since 1974