9.7. Which is best?ΒΆ
Anything that can be done with modifiers and fill-in functions can also be done with pure functions. In fact, there are programming languages, called functional programming languages, that only allow pure functions. Some programmers believe that programs that use pure functions are faster to develop and less error-prone than programs that use modifiers. Nevertheless, there are times when modifiers are convenient, and cases where functional programs are less efficient.
In general, I recommend that you write pure functions whenever it is reasonable to do so, and resort to modifiers only if there is a compelling advantage. This approach might be called a functional programming style.
- Writing modifiers only if there is a compelling advantage. Otherwise, write pure functions.
- Correct!
- Writing fill-in functions only if there is a compelling advantage. Otherwise, write modifiers.
- Try again.
- Writing pure functions only if there is a compelling advantage. Otherwise, write modifiers.
- Try again.
Q-1: What is a functional programming style?
Q-2: Anything that can be done with modifiers and fill-in functions can also be done with ____.