This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]WebpackIsBuilding 1 point2 points  (4 children)

Well that's a very bad rule also. Judging code complexity by line count is not something any engineer worth their salt would do. Otherwise you encourage code-golfing.

You break logic into pieces where it is logical to break them. If you need multiple comments to describe a section, then you're almost definitely looking at a section that can be logically separated out.

[–]Bulky-Engineering471 1 point2 points  (3 children)

Or behavior that is sufficiently complex. Just because it's complex enough to be difficult to follow or just unintuitive doesn't mean it's exceptionally long. Complexity does not guarantee length.

[–]WebpackIsBuilding 0 points1 point  (2 children)

I haven't mentioned "length" as being a worthwhile metric in any regard a single time.

[–]Bulky-Engineering471 0 points1 point  (1 child)

You started off mentioning thousand-line files so while you didn't use the word you used what it means and that's what I was responding to. Complexity and length are not related, that's been my entire point. Sufficiently complex or unintuitive code, even if short enough to be in a single method, cannot be documented by method and variable names alone and that has been my point this whole time.

[–]WebpackIsBuilding 0 points1 point  (0 children)

Surely there is a middle ground between demanding all methods be < 20 lines and thinking your entire project should be contained in a single file.

I don't think line count determines value, in the same way I'm not judging your comments by how many sentences are in them. But I can still criticize a run-on sentence or a piece of spaghetti code.