... |
... |
@@ -23,7 +23,9 @@ |
23 |
23 |
#### Function Arguments |
24 |
24 |
|
25 |
25 |
* **The fewer arguments, the better.** Triads should be avoided. More than three arguments are not allowed. The fewer arguments a function takes, the easier it is to understand and the less error-prone it is. |
26 |
|
-* There are two common types of monadic functions: * 1. Monad that asks the argument a question or manipulates/converts it. * 1. Events = monads with no return value. The reader should recognize that it is an event by the functions context and name→ Otherwise, do not use monadic functions. |
|
26 |
+* There are two common types of monadic functions: |
|
27 |
+ 1. Monad that asks the argument a question or manipulates/converts it. |
|
28 |
+ 1. Events = monads with no return value. The reader should recognize that it is an event by the functions context and name→ Otherwise, do not use monadic functions. |
27 |
27 |
* **Avoid flag arguments.** It shows that the function performs two tasks, depending on whether the flag is true or false. |
28 |
28 |
* **Dyads should be converted to monads if possible**, but cannot always be avoided. Sometimes they are useful, e.g. when passing 2D coordinates, because the arguments are connected by a cohesion. |
29 |
29 |
* **Argument objects:** When many arguments are to be passed to a function, it often makes sense to combine them as a separate concept in a new class/data structure. |