Clean Code Flashcards

1
Q

What is clean code?

A

It refers to code that is easy to read, understand, and maintain.

It follows best practices, is well-structured, and has a consistent style.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is writing clean code important?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some best practices for writing clean code?

A
  • using descriptive variable and function names,
  • writing small and focused functions,
  • using meaningful comments,
  • following a consistent code style,
  • avoiding unnecessary complexity.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the “Don’t Repeat Yourself” (DRY) principle in clean code?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the “Keep It Simple, Stupid” (KISS) principle in clean code?

A

It means that code should be as simple and straightforward as possible.

It should avoid unnecessary complexity, and be easy to understand and maintain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the principles of clean code?

A

Some examples:
- readability,
- maintainability,
- consistency,
- simplicity,
- DRY (Don’t Repeat Yourself).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly