Quality Assurance IV, Clean Code

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

What is the difference between statement vs. branch coverage?

- Statement Coverage: Ensures each line of code runs at least once.

- Branch Coverage: Ensures every possible branch (true/false decisions) is tested.

2
New cards

Testing at Tech Giants - Shift Left Testing

Test early in dev cycle.

- Use CI/CD pipelines for auto tests.

- Developers write unit/integration tests

.- Google requires passing unit tests before code merges.

3
New cards

CI/CD Pipeline

- Continuous Integration / Continuous Deployment pipelines automate build, test, and deployment

.- Runs tests frequently to catch bugs early.

4
New cards

Automated Testing at Scale

- Automate all test types (unit, integration, UI).

- Use AI to detect anomalies & generate tests.

- Run tests in parallel in cloud.

- Facebook runs millions of tests daily.

5
New cards

Chaos Engineering for Resilience

- Intentionally break systems to test recovery.

- Use tools like Chaos Monkey.

- Monitor recovery speed.

- Amazon uses Game Days to simulate failures.

6
New cards

Canary Releases & A/B Testing

- Release to small user set first.

- Measure performance & errors.

- Roll back on failure

.- Microsoft uses feature flags to toggle feature

7
New cards

Observability & Monitoring

- Log everything centrally.

- Use distributed tracing to monitor requests.

- AI-based alerts for anomalies.

- Google SRE teams use real-time dashboards.

8
New cards

Clean Code: Why important?

- Cleaner code = better programmers.

- Easier to understand, maintain, and extend.

9
New cards

Clean Code - Characteristics

- Elegant, efficient, readable like prose.

- Simple, direct.

- Looks like it's written by someone who cares.

- High expressiveness, low duplication.

10
New cards

Good Naming Practices

- Use intention-revealing, searchable, pronounceable names.

- Avoid encodings and disinformation.

- Good class names: nouns (e.g., Customer, WikiPage).

- Good method names: verbs (e.g., postPayment, saveFile).

11
New cards

Function Guidelines

- Keep them small (<20 lines).

- Do one thing only.

- Use top-down structure (called function appears above called function).

- Use descriptive names.

12
New cards

Arguments in Functions

- Prefer fewer arguments: 0 ideal, 1–2 okay, 3+ justify, 4+ avoid.

- Use objects to group arguments (e.g., use Point instead of x and y).

13
New cards

Comments - When to Use

- Use only when code cannot be self-explanatory.

- Prefer readable code over needing comments.

- Use informative or explanatory comments.

- Mark TODOs clearly.

- Avoid noise/redundant comments.

14
New cards

Class Guidelines

- Keep classes small.

- SRP (Single Responsibility Principle): each class has one reason to change.

- Organize: constants, variables, public functions, then private helpers.