Clean Code Flashcards
What is clean code?
It refers to code that is easy to read, understand, and maintain.
It follows best practices, is well-structured, and has a consistent style.
Why is writing clean code important?
Because it makes it easier to understand and modify code, which reduces bugs and improves maintainability.
It also helps make code more reusable and improves collaboration among team members.
What are some best practices for writing clean code?
- using descriptive variable and function names,
- writing small and focused functions,
- using meaningful comments,
- following a consistent code style,
- avoiding unnecessary complexity.
What is the “Don’t Repeat Yourself” (DRY) principle in clean code?
It means that code should not be duplicated across multiple places in a program.
Instead, it should be abstracted into a reusable function or module.
What is the “Keep It Simple, Stupid” (KISS) principle in clean code?
It means that code should be as simple and straightforward as possible.
It should avoid unnecessary complexity, and be easy to understand and maintain.
What are the principles of clean code?
Some examples:
- readability,
- maintainability,
- consistency,
- simplicity,
- DRY (Don’t Repeat Yourself).