News for hackers. Stuff that matters.
Re:Programming Patterns I Like by quadcore on Saturday June 29, 2019 @04:32AM (#20311466)
Or is it that you (guys) can't have bigger functions because you impulsively fill them with early returns? So you end up over-engineering things just to avoid bigger functions (because you can't have them because they are filled with early returns). Real question, I don't have the answer, but that question is my take from this discussion.
Re:Programming Patterns I Like by DogLover_ on Saturday June 29, 2019 @05:07AM (#20311579)
If you don't use early returns don't you end up with functions doing lots of state/variable mutation (within the function)? Thats what I consider the problem with big function and/or not using early returns. You then need to keep track of all those modification. I find it much easier to reason with early returns.

You can certainly over-engineer things just to avoid bigger functions. However from my experience I see that far less than complicated large functions with little care to readability.

Re:Programming Patterns I Like by quadcore on Saturday June 29, 2019 @05:14AM (#20311601)
don't you end up with functions doing lots of state/variable mutation (within the function)?

Good question. This is true, but this is a programming language bug. In some programming language you can write the equivalent of return if... or return for.... Also note that those intermediate variables add a lot in expressiveness (you're computing result or screensize etc). The mutation is unfortunate indeed but a programming language bug.