On Fri, Jun 23, 2023 at 11:36?AM David Rosenstrauch <
darose@...> wrote:
On 6/22/23 5:23?PM, Mark Levison wrote:
> On the way we encountered a JavaScript function that took a boolean
> parameter, so the code read like: FooBar(..., True). We discussed why
> this is a poorly written function and then I promised: "I promised even
> if I'm fifty years dead, I will return from the grave too haunt her if
> she ever writes a method that accepts a boolean parameter."
Alright, I'll bite:? what is the issue you see with having a boolean
parameter?
I usually feel uncertain about what the boolean means, especially from reading only the invocation. I rarely regret replacing this with, at least, a symbol/enum/other intention-revealing value.
Not always, but quite close to always.
-- J. B. (Joe) Rainsberger :: ?:: ::
Replies from this account routinely take a few days, which allows me to reply thoughtfully. I reply more quickly to messages that clearly require answers urgently. If you need something from me and are on a deadline, then let me know how soon you need a reply so that I can better help you to get what you need. Thank you for your consideration.
--
J. B. (Joe) Rainsberger :: :: ::
Teaching evolutionary design and TDD since 2002