procName()
mob.someVar = mob.proc1() * mob.proc3()
return mob.proc2()
Looking at that code, maybe you can guess that proc1() and proc3() return numerical values, and whatever proc2() returns is god knows what. Only the initial programmer would know. But for the sake of maintaining code over generations of edits, such shorthand notation isn't always better. You'll come back to it some 2+ months later and think, "What the shell was going on here? What do these functions even mean?" and even if you've left comments like what the procs return, you still need to figure out why you're doing what you're doing and what its overall impact is.
This is why I think that fundamentally, a little bit of step-by-step goes a long way (in the "long-run", so to speak).
rewriting that original code from before
procName()
q1 = mob.proc1() // Naturally you need comments
q2 = mob.proc3()
mob.someVar = q1 + q2
return mob.proc2() // Can't think of a good example for this atm.
This is really just a limited example I came up with right before class, but stew on this a bit. I personally believe that it's easier to follow, especially if you're working with other programmers on your game. Sure, it's less efficient, but it lets you know what you're doing with what you're doing.
In most cases, if you are dealing with a complex procedure with multiple loops, then your second example will always be more efficient than the first. Being more modular and readable is actually just an added side effect in this case. Think about what is going on here. If you added a loop to the first example, you would be calling mob.proc1() and mob.proc3() over and over again. If you added a loop to the second example, those procs would only be called once, because you are storing the return values for reuse later on. While this doesn't really apply to a proc that simple, it's still a valid point to make.
What I'm trying to say is that the second example is more efficient, more readable, and more modular than the first when you scale the procedures up to a more realistic complexity, so there is really no point at all to ever worry about the first example.