News for hackers. Stuff that matters.
Re:Anti-if: The Missing Patterns by Kristine1975 on Friday June 10, 2016 @01:53AM (#11874540)
>This makes the code clearer, IMO.

Depends on how much state you need to pass between A, B1, B2 and C.

Re:Anti-if: The Missing Patterns by majewsky on Friday June 10, 2016 @04:57AM (#11875118)
It also depends on the semantic value of A, B1, B2 and C. If you cannot express them as senseful steps of your overall algorithm, then you are bound to end up with very confusing method names like calculateFooAndCreateBarAndAlsoInitializeBaz, or (even worse) prepareForFoo.

EDIT: By the way, an anecdote. Years ago, I was working with an offshore developer who was producing huge scripts without any modularization whatsoever. In particular, we told him that a certain 2000-line script needed to be modularized, so he should break out steps into functions etc. He produced a new version containing two functions of 1000 lines each. The first function would prepare everything, then tail-call the second function with 27 arguments, most of them large intermediate data structures.

Re:Anti-if: The Missing Patterns by Kristine1975 on Friday June 10, 2016 @07:13AM (#11875547)
Could have been worse: He could have made 1000 functions two lines each.
Re:Anti-if: The Missing Patterns by jasonlotito on Friday June 10, 2016 @10:10AM (#11876433)
If the amount of state you need to pass is that significant, that is another code smell that needs its own resolution.