To piggyback off of gjm’s comment, it isn’t necessarily true that every function is a get. For example, in JavaScript you could have a function that doesn’t return anything and only has a side effect. But even in functional languages, you still need to have side effects at some point if you want your code to do something interesting. I’ve been following a guy named Eric Normand recently who likes to talk about this, and emphasizes that functional languages are about separating side effects from pure code, not avoiding them. See Why side-effecting is not all bad.
Right, but in the naming style I know, promotedPosts would never have a visible side effect, because it’s a noun. Side-effectful functions have imperative names, promotePosts - and never the two shall mix.
To piggyback off of gjm’s comment, it isn’t necessarily true that every function is a get. For example, in JavaScript you could have a function that doesn’t return anything and only has a side effect. But even in functional languages, you still need to have side effects at some point if you want your code to do something interesting. I’ve been following a guy named Eric Normand recently who likes to talk about this, and emphasizes that functional languages are about separating side effects from pure code, not avoiding them. See Why side-effecting is not all bad.
Right, but in the naming style I know,
promotedPosts
would never have a visible side effect, because it’s a noun. Side-effectful functions have imperative names,promotePosts
- and never the two shall mix.