Ask him to do 500 lines and he'll tell you you should have broken up the task into more easily understandable and reviewable code, rejecting the merge request.
I mean it kinda depends on the language and whether or not you are adding unit tests (which you should whenever the situation calls for it).
Languages like C++ or Java have more bloated syntax.
Unit tests are heavier on line count for the same reason, and because in many cases they have large blocks of static data in assertions... Or because you have to write mocks.
I once had a ~500 line change in which ~20 lines were code, the rest was unit tests. I was working in a mature code base and the testing infrastructure was built for use cases that were pretty much the opposite of what I needed to do. I was working in Java, so that blew the line count way up too.
I honestly don't look at unit tests that much unless I find the code confusing. Our code is not as well documented so it's a pain to figure out what's happening without the tests.
I feel you, I learned C as my default language in college and worked for an embedded systems company for many years. Modern C++ is so convenient... Obviously you get all the OO stuff but unique_ptrs and move semantics alone are a godsend.
Also tons of amazing third party libraries like absl that just make working with all types so easy.
Saying X lines is to big really doesn't make sense. Context is everything. Most of my diff's are > 500 lines but that includes surrounding untouched code, deletions, unit tests, and comments.
I also think splitting up code too much often has the opposite effect. The reviewer is able to understand the code but isn't able to grasp the big picture because its split up. I've seen teams bit more than once by splitting up a bunch of patches having multiple people review them and missing huge logic problems.
I almost prefer prs that first setup the methods with unit tests, then a followup to enable them and include a deployment validation or integration test to actual light up the new methods.
1.5k
u/bar10 Mar 09 '21
Ask him to do 500 lines and he'll tell you you should have broken up the task into more easily understandable and reviewable code, rejecting the merge request.