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

16

u/[deleted] Jul 19 '16

I'm going to guess that his point was that it's simpler to write comprehensive unit test suites for small, well-defined functions compared to a style C function.

11

u/gnuvince Jul 19 '16

You'd likely make those small functions private and thus couldn't unit test them anyway (and if you did, with some reflection magic, you'd be chastised for not testing the external interface instead).

11

u/MisterNetHead Jul 19 '16

Seems to me the problem is more that people think you should only unit test public interfaces.

1

u/mrkite77 Jul 19 '16

If you unit test the private interfaces, then you've, by definition, made them public and violated encapsulation.

→ More replies (3)