# Bug

> A mistake in software that makes it behave differently from what was intended.

- Level: Basic
- Topics: Software
- URL: https://tidbit.legios.com.ar/bug/
- In Spanish: [Bug](https://tidbit.legios.com.ar/es/bug/)

A **bug** is a flaw in a program that makes it do something its authors did not intend: a button that does nothing, a total that adds up wrong, an app that crashes when you rotate the phone. Computers follow instructions exactly, so a bug is almost always a human mistake in those instructions, or a situation nobody planned for, like a name with an apostrophe or a date in a leap year.

Engineers used the word for machine faults long before computers. The famous story is from 1947: operators of the Harvard Mark II computer, a team that included Grace Hopper, found a real moth stuck in a relay and taped it into their logbook as the "first actual case of bug being found". The joke works precisely because the word was already in use.

Some bugs are cosmetic, others are serious. A bug that lets an attacker read data they should not see is a security vulnerability. Bugs are normal in any large program; what matters is catching them early through testing and code review, and fixing them with **debugging**. Teams usually track them in a bug tracker, with steps to reproduce, how severe they are and who is working on them.

## An analogy

A typo in a recipe that says "3 cups of salt" instead of "3 teaspoons". The cook follows it faithfully, and the result is ruined, not because the cook failed but because the instructions were wrong.

## Keep in mind

- A mistake or unforeseen case in a program's instructions.
- Ranges from cosmetic glitches to crashes and security holes.
- The famous 1947 moth was a joke on a word engineers already used.
- Found through testing and reports, fixed through debugging.

## Go deeper

- [Software bug on Wikipedia](https://en.wikipedia.org/wiki/Software_bug)
- [Grace Hopper on Wikipedia](https://en.wikipedia.org/wiki/Grace_Hopper)

## Related terms

- [Vulnerability and CVE](https://tidbit.legios.com.ar/vulnerability-and-cve/): A flaw that lets an attacker misuse software, and the public id that names it.
- [Code review](https://tidbit.legios.com.ar/code-review/): Having another person read a code change before it becomes part of the product.
- [Debugging](https://tidbit.legios.com.ar/debugging/): The detective work of finding why a program misbehaves, and fixing it.
