Design Patterns · Junior · Question 43 of 75

A function takes 7 arguments. Which refactoring is usually appropriate?

Explanation

A long parameter list is a "code smell": it's easy to mix up the order. An object with destructuring ({ id, title, onSave }) is self-documenting and allows default values. Sometimes it's a sign that the function does too much.

Further reading

Problem with a question

Design Patterns · Junior · question 43

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