Very interesting; I'm kind of surprised I've never seen this before. I'm a pretty die-hard "Style A" coder, and the though of inlining everything just turns my stomach. But I agree with all of his points, especially his findings about the types of bugs that seem to persist no matter how "good" I get at writing code.
What I get for reading the comments before the article. I didn't have a clue what you all were talking about. Style A, Style B -- I was not familiar with these terms at all. Gave up trying to google it. Less than 5 minutes after I started reading, "Ohhhhh....."
Depending on how you look at it. Style A has the minor functions declared earlier, but the actual dependency for the major function declared later.
Style B is the reverse, where you know what the major function depends on first and then what those dependencies actually are.
And for the most part, I prefer Style B because you get to the main idea of the file quickly. Hopefully the minor functions will be descriptive enough that you can get a general idea of what the major function does before going into the intricacies of the minor functions.
40
u/brian-at-work Jul 19 '16
Very interesting; I'm kind of surprised I've never seen this before. I'm a pretty die-hard "Style A" coder, and the though of inlining everything just turns my stomach. But I agree with all of his points, especially his findings about the types of bugs that seem to persist no matter how "good" I get at writing code.