Which software development principle emphasizes writing modular and reusable…

2024

Which software development principle emphasizes writing modular and reusable code ?

  1. A.

    DRY (Don't Repeat Yourself)

  2. B.

    KISS (Keep It Simple, Stupid)

  3. C.

    YAGNI (You Ain't Gonna Need It)

  4. D.

    SOLID principles

Attempted by 49 students.

Show answer & explanation

Correct answer: A

The correct answer is Option A, DRY (Don't Repeat Yourself). This principle explicitly advocates for reducing code duplication by creating modular components that can be reused across different parts of a system. By writing reusable functions, classes, or modules, developers ensure that logic exists in only one place, making maintenance easier and reducing errors. While KISS focuses on simplicity to avoid unnecessary complexity, it does not specifically address modularity or reuse. Similarly, YAGNI advises against adding features until they are strictly needed, which is about scope management rather than code structure. Although SOLID principles do promote modularity through separation of concerns, DRY is the specific acronym dedicated to eliminating redundancy via reusable code. Therefore, DRY is the most direct answer to a question emphasizing modularity and reusability.

Explore the full course: Niacl Ao It Specialist