Sobes.tech
Senior

What do the abbreviations KISS and DRY mean?

sobes.tech AI

Answer from AI

KISS (Keep It Simple, Stupid) — a development principle that encourages making systems as simple as possible and avoiding unnecessary complexity. This helps improve code readability, ease maintenance, and reduce the likelihood of errors.

DRY (Don't Repeat Yourself) — a principle aimed at eliminating code and logic duplication. The idea is that each piece of knowledge or logic exists in the system in a single instance, which simplifies maintenance and reduces the risk of inconsistency during changes.

Example in Go:

// Violation of DRY
func sum1(a, b int) int {
    return a + b
}

func sum2(a, b int) int {
    return a + b
}

// Correct, use a single function
func sum(a, b int) int {
    return a + b
}

The KISS principle can be applied by avoiding overly complex structures and choosing simple solutions, such as using standard libraries and understandable algorithms.