News for hackers. Stuff that matters.
Re:John Carmack on Inlined Code (2014) by taeric on Tuesday July 19, 2016 @01:43PM (#12123343)
Isn't this a bit of a strawman, though? All too often, you instead get the likes of:

    a = subOperationA(a, b, c, d, e, f, g, h, i)
    b = subOperationB(a, d, e, f, g, h, i, j, k)
    c = subOperationC(d, e, f, g, h, i, j, k, l)
    return c
And then some poor fool breaks each of those up into about 8 functions each. So, you click into subOperationA to find it is subOperationAa chaining to subOperationAb,....

My gripe is when we argue against having the full solution in your mind as you work the pieces. Logically, it makes sense to reduce everything down to named things. Cognitively, that is expensive.

And yes, I'm responding with an equally opposing strawman. I am beginning to reject that there is a "one true answer."

Re:John Carmack on Inlined Code (2014) by saynsedit on Tuesday July 19, 2016 @02:56PM (#12123929)
This is not really about subroutines, it's about abstractions. Good abstractions decrease cognitive load, bad ones increase it. The one true answer is to aim for good abstractions, and not factor code into subroutines at arbitrary boundaries.

For example, adding two n-length vectors is a good abstraction ("vector_add"). Adding two n-length vectors then multiplying the magnitude of the result by 3 is a bad abstraction.

Re:John Carmack on Inlined Code (2014) by sbov on Tuesday July 19, 2016 @02:27PM (#12123700)
> I am beginning to reject that there is a "one true answer."

There are basically no guidelines that always apply. Novices should stick to them, and people with more experience can recognize when they don't apply.

Re:John Carmack on Inlined Code (2014) by Retra on Wednesday July 20, 2016 @12:57AM (#12126990)
It's usually very safe and convenient to not inline pure functions. At least while debugging.
Re:John Carmack on Inlined Code (2014) by jschwartzi on Tuesday July 19, 2016 @08:59PM (#12126143)
The sooner you learn that there are no hard and fast rules, the easier life will be for your teammates and for anyone you try to lead. Most of the conflicts I have with my lead boil down to him wanting to resolve a decision using a hard always/never dichotomy, and me wanting to use my best judgement.