Chapter 9. Debugging, Testing, and Deployment

This chapter is about the parts of software development that often do not get enough love: debugging, testing, and deployment. It’s a guide to everything from spotting different bugs, to writing docs that people can actually understand, to making sure your code does what it’s supposed to. We’ll also dive into how to merge changes without a hitch, make your software run smoothly and safely, take in what users say, and even how to make a splash when you launch.

Debugging

When creating code, a developer will spend around 35% to 50% of their time on debugging. This is not just a time sink. It also eats up a big chunk of the budget in a software project.

There are two main types of bugs. First, there are syntax errors. These pop up when your code doesn’t play by the rules of the structure of a language. It can be as simple as forgetting to add a colon at the end of a for loop. A modern IDE like VS Code should detect and fix many of these types of errors.

Next, there are logical errors. These are trickier because they happen when something in your logic is off. For example, suppose you have created a program to filter out adult users from a list based on their age. The only problem is, instead of excluding everyone aged 18 and above, your code mistakenly excludes those under 18. So, you end up with a list full of adults instead of teens. This mix-up is a prime example of a logical error. Your code is doing the exact opposite of what you ...

Get AI-Assisted Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.