One thing I'm learning to love about Task Based Programming (is that an existing term? TBP?) is that it makes some habits clear. For example, there seem to be two camps about function length. One says "Functions should do exactly one thing".
-
-
In Task Based Programming (at least, the variety I'm doing), the "size" of a function has real meaning, because each function is (usually) a task. Your function length and design becomes determined by profiling. Seeing core usage drop? Might be that function is too "big".
Näytä tämä ketju -
Spending a lot of time in task overhead? Tasks are too small: try batching work together (which may take some re-organization). For this, many small loops is better than 1 loop that does many things (parallelizes better).
Näytä tämä ketju -
For "helper" functions, which in this context are functions that are not themselves a task, but called by tasks, you can still run into the danger of 1-line-per-function codebases. I'm generally not in that camp of "ideal function size" so not a problem here.
Näytä tämä ketju -
Here's the larger point, I think. Lots of things come down to preference in programming. It's nice to have a "preference" made clearer by something that the machine cares about. I wonder how many more "preferences" there are like this that we haven't found yet.
Näytä tämä ketju -
Moreover, "machine preference" will always win in the end. Machine preference is why DoD is in vogue right now. DoD works because it makes the computer faster and we've found a way to make it digestible to humans.
Näytä tämä ketju
Keskustelun loppu
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.