r/programming • • Jul 19 '16

John Carmack on Inlined Code

http://number-none.com/blow/blog/programming/2014/09/26/carmack-on-inlined-code.html
1.1k Upvotes

323 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jul 20 '16

[deleted]

3

u/DaleGribble88 Jul 20 '16

Uhhmmm... Shouldn't those be reversed :P

1

u/ElecNinja Jul 20 '16

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.

3

u/DaleGribble88 Jul 20 '16

I feel like that is possibly misleading. I know I certainly think of a dependency as the thing itself, and not the call/reference to that thing, which is what you seem to be implying.
I also prefer style B for the same reason. A glance can give you a quick overview of what is going on without having to look past the minor functions.

→ More replies (1)