Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • I only use boolean arguments to control behavior in private methods (as shown here). But the problem: If some dufus decides to increase the visibility of FooInternal in the future, then what? Commented Oct 15, 2014 at 7:35
  • Actually, I'd go another route. The code inside FooInternal should be split into 4 pieces: 2 functions to handle the Boolean true/false cases, one for the work that happens before, and another for the work that happens after. Then, your Foo1 becomes: { doWork(); HandleTrueCase(); doMoreWork() }. Ideally, the doWork and doMoreWork functions are each broken down into (one or more) meaningful chunks of discrete actions (i.e. as separate functions), not just two functions for the sake of splitting. Commented Jun 14, 2017 at 19:44
  • That was a "simple direct to the point" example. Commented Jan 5 at 9:55