Design Patterns · Junior · Question 49 of 75

Why are pure functions useful in design?

Explanation

A pure function without side effects is predictable: the same input gives the same output. It pays to move business logic (price calculation, validation) into pure functions and keep side effects at the edges of the system.

Further reading

Problem with a question

Design Patterns · Junior · question 49

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