# Clean Code Principles

> Best practices for writing maintainable, readable, and efficient code with practical examples

- **Canonical URL:** https://flashcards.world/flashcards/sets/3a14b5c4-b80e-4801-8183-3b1bf59a33b7/
- **Markdown URL:** https://flashcards.world/flashcards/sets/3a14b5c4-b80e-4801-8183-3b1bf59a33b7.md
- **Category:** Programming
- **Level:** intermediate
- **Languages:** en → en
- **Total Cards:** 47

## Flashcards (47 Cards)

| # | Front (Term / Prompt) | Back (Definition / Answer) | Example | Multiple-Choice Options |
| :--- | :--- | :--- | :--- | :--- |
| 1 | How does 'refactoring' contribute to Clean Code? | Refactoring improves the structure of existing code without changing its external behavior, enhancing readability and maintainability. |  |  |
| 2 | What is the 'principle of least privilege'? | The principle of least privilege states that users and systems should have the minimum level of access necessary to perform their functions. |  |  |
| 3 | What is 'code documentation'? | Code documentation provides explanations and context for code, helping other developers understand its purpose and usage. |  |  |
| 4 | What does 'agile methodology' emphasize? | Agile methodology emphasizes flexibility, collaboration, and customer feedback, allowing for rapid iteration and improvement of software. |  |  |
| 5 | What is the 'Liskov Substitution Principle'? | The Liskov Substitution Principle states that objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. |  |  |
| 6 | What does 'agile development' contribute to Clean Code? | Agile development promotes iterative progress and flexibility, encouraging frequent refactoring and adaptation to changing requirements. |  |  |
| 7 | What does 'meaningful names' refer to in Clean Code? | Meaningful names refer to using descriptive and unambiguous names for variables, functions, and classes to convey their purpose clearly. |  |  |
| 8 | What is the importance of comments in Clean Code? | Comments should explain 'why' something is done, not 'what' is done; well-written code should be self-explanatory, minimizing the need for comments. |  |  |
| 9 | What does 'composition over inheritance' mean? | Composition over inheritance is a design principle that favors composing objects with desired behaviors rather than inheriting from a base class. |  |  |
| 10 | What is 'static code analysis'? | Static code analysis is the examination of code without executing it, identifying potential errors, vulnerabilities, and adherence to coding standards. |  |  |
| 11 | What does 'test coverage' refer to? | Test coverage refers to the percentage of code that is tested by automated tests, indicating the extent to which the codebase is validated. |  |  |
| 12 | Why is consistent formatting important in Clean Code? | Consistent formatting improves readability and makes it easier for developers to navigate and understand the codebase. |  |  |
| 13 | What is 'agile retrospectives'? | Agile retrospectives are meetings held at the end of an iteration to reflect on what went well, what didn't, and how to improve in the next cycle. |  |  |
| 14 | What is the 'KISS' principle? | KISS stands for 'Keep It Simple, Stupid.' It emphasizes simplicity in design and implementation to avoid unnecessary complexity. |  |  |
| 15 | What is 'agile testing'? | Agile testing is a practice that integrates testing into the development process, ensuring that quality is maintained throughout the software lifecycle. |  |  |
| 16 | What is the significance of 'user feedback' in Clean Code? | User feedback provides insights into how well the code meets user needs, guiding improvements and ensuring the software is user-friendly. |  |  |
| 17 | Why is it important to handle errors gracefully? | Graceful error handling improves user experience and system reliability by preventing crashes and providing meaningful feedback. |  |  |
| 18 | What is 'agile planning'? | Agile planning involves defining the scope and objectives of a project in a flexible manner, allowing for adjustments based on ongoing feedback and changes. |  |  |
| 19 | What is 'separation of concerns'? | Separation of concerns is a design principle that divides a program into distinct sections, each addressing a separate concern, improving modularity. |  |  |
| 20 | What does 'modular design' entail? | Modular design involves breaking down a program into smaller, self-contained modules that can be developed, tested, and maintained independently. |  |  |
| 21 | What does 'behavior-driven development' (BDD) involve? | BDD involves writing tests in a natural language format that describes the behavior of the application, facilitating collaboration between developers and non-technical stakeholders. |  |  |
| 22 | How can 'pair programming' enhance Clean Code practices? | Pair programming encourages collaboration and immediate feedback, leading to higher quality code and shared knowledge among team members. |  |  |
| 23 | What is the significance of 'version control' in Clean Code? | Version control tracks changes to code, allowing for collaboration, history tracking, and easy rollback to previous versions if needed. |  |  |
| 24 | Why is it important to keep functions small? | Small functions are easier to understand, test, and reuse, promoting better readability and maintainability. |  |  |
| 25 | What is the primary goal of Clean Code principles? | The primary goal of Clean Code principles is to write code that is easy to read, understand, and maintain. |  |  |
| 26 | What is the 'principle of least astonishment'? | The principle of least astonishment states that code should behave in a way that least surprises the user, making it intuitive and predictable. |  |  |
| 27 | What is 'agile coaching'? | Agile coaching involves guiding teams in adopting agile practices, improving their processes, and fostering a culture of continuous improvement. |  |  |
| 28 | What is 'continuous integration'? | Continuous integration is a practice where developers frequently integrate code changes into a shared repository, allowing for early detection of issues. |  |  |
| 29 | What is the 'YAGNI' principle? | YAGNI stands for 'You Aren't Gonna Need It.' It advises against adding functionality until it is necessary to avoid overcomplicating the code. |  |  |
| 30 | What is meant by 'code smells'? | Code smells are indicators of potential problems in code, such as duplicated code, long methods, or excessive parameters, suggesting that refactoring may be needed. |  |  |
| 31 | What does 'DRY' stand for and why is it important? | DRY stands for 'Don't Repeat Yourself.' It is important because it reduces redundancy, minimizes errors, and makes code easier to maintain. |  |  |
| 32 | What is 'pair testing'? | Pair testing involves two testers working together to test a feature, combining their perspectives to identify issues more effectively. |  |  |
| 33 | What is 'code review' and its significance? | Code review is the process of evaluating code changes by peers, which helps identify issues, improve code quality, and share best practices. |  |  |
| 34 | What is the 'Open/Closed Principle'? | The Open/Closed Principle states that software entities should be open for extension but closed for modification, allowing for new functionality without altering existing code. |  |  |
| 35 | What is the 'Dependency Inversion Principle'? | The Dependency Inversion Principle states that high-level modules should not depend on low-level modules; both should depend on abstractions. |  |  |
| 36 | What is the role of 'design patterns' in Clean Code? | Design patterns provide proven solutions to common problems, promoting code reuse and improving code organization. |  |  |
| 37 | What is the importance of 'user stories' in Clean Code? | User stories help define requirements from the user's perspective, ensuring that the code developed meets actual user needs. |  |  |
| 38 | What does 'agile backlog' mean? | An agile backlog is a prioritized list of tasks, features, and requirements that need to be completed in a project, guiding development efforts. |  |  |
| 39 | What does 'encapsulation' mean in the context of Clean Code? | Encapsulation is the practice of restricting access to certain components of an object, promoting modularity and reducing dependencies. |  |  |
| 40 | What is the 'Single Responsibility Principle'? | The Single Responsibility Principle states that a class should have only one reason to change, meaning it should only have one job or responsibility. |  |  |
| 41 | What does 'cross-functional teams' mean? | Cross-functional teams consist of members with different expertise working together towards a common goal, enhancing collaboration and innovation. |  |  |
| 42 | What is 'technical debt'? | Technical debt refers to the implied cost of additional rework caused by choosing an easy solution now instead of a better approach that would take longer. |  |  |
| 43 | What is the role of 'unit tests' in Clean Code? | Unit tests verify that individual components of the code work as intended, ensuring reliability and facilitating future changes. |  |  |
| 44 | What is 'user acceptance testing' (UAT)? | User acceptance testing is the final phase of testing where actual users validate the software against their requirements before it goes live. |  |  |
| 45 | What is 'code maintainability'? | Code maintainability refers to how easily code can be modified, updated, or extended over time without introducing errors. |  |  |
| 46 | What does 'code simplicity' mean? | Code simplicity refers to writing code that is straightforward and easy to understand, avoiding unnecessary complexity. |  |  |
| 47 | What does 'test-driven development' (TDD) involve? | TDD involves writing tests before writing the corresponding code, ensuring that the code meets requirements and is less prone to bugs. |  |  |

---
Study this deck interactively with FSRS-6 spaced repetition, audio review, and multiple-choice mode at [Flashcards World](https://flashcards.world/flashcards/sets/3a14b5c4-b80e-4801-8183-3b1bf59a33b7/).
