Making Programs easy to read unit 2 Flashcards
(7 cards)
Why is it important to make code easy to read?
So others (and your future self) can understand what it does and how it works.
What are the four main techniques to improve code readability?
- Comments
- Descriptive names
- Indentation
- White space
How do comments help readability?
They explain what the code does, especially complex parts, without affecting how the program runs.
Why use descriptive names for variables and functions?
They make it clear what each variable or function represents or does.
What does indentation do?
It shows the structure of the program, like what belongs inside a loop or if statement.
How does white space improve readability?
It separates parts of the code visually, making it less crowded and easier to follow.
What is the benefit of readable code during debugging or testing?
It’s faster and easier to find and fix mistakes.