Design Patterns · Junior · Question 74 of 75

What does the Principle of Least Astonishment say?

Explanation

A function getUser() shouldn't also send emails; a "Cancel" button shouldn't save. Surprises cause bugs.

Further reading

Problem with a question

Design Patterns · Junior · question 74

Test yourself

Take the Design Patterns · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz