Re:The Power of Ten – Rules for Developing Safety Critical Code
by DasIch on Thursday July 14, 2016 @01:00PM
(#12095471)
Keep in mind that we're talking about C code here. Error handling etc. blows that up quite significantly.
Re:The Power of Ten – Rules for Developing Safety Critical Code
by crpatino on Thursday July 14, 2016 @12:02PM
(#12094947)
I agree that making functions shorter does not automatically make them safer, but I do see how having a well designed "main" function in the ballpark of ~80LOC which calls another 10 auxiliary (and inlined) minor functions of ~15-25LOC would be easier to reason about than an equivalent function of ~220LOC.
The fact that you could safisfy the business requirement with a single function of ~140LOC does not mean the other approach is more verbose, but that you are only thinking on the happy path, and a bunch of edge cases are left undefined.
Re:The Power of Ten – Rules for Developing Safety Critical Code
by paulryanrogers on Thursday July 14, 2016 @11:19AM
(#12094582)
While the embedded world does have some hard depth limits, my experience has been that the readability of breaking up a function are worth it. This seems especially true when the nested functions are carefully named.
I started having headache spikes after reading this sentence that refers to keeping functions "short", in the article about safety critical programs.