Skip to main content

Timeline for Are long methods always bad?

Current License: CC BY-SA 3.0

20 events
when toggle format what by license comment
Nov 14, 2012 at 7:34 comment added Tulains Córdova Long methods are bad.
Oct 17, 2012 at 21:33 history edited Deiwin CC BY-SA 3.0
typo
Oct 16, 2012 at 20:54 history edited JW01 CC BY-SA 3.0
Altered formatting to show that, for those who don't know, code complete is actually the title of a book.
Oct 16, 2012 at 19:06 comment added Songo 200 lines?!! I consider 20 lines too long!
Oct 16, 2012 at 16:14 comment added deadalnix @ConradFrix 200 lines is already a long routine according to most standards.
Oct 16, 2012 at 15:02 comment added wonea Nice answer, and particularly like the point of 'most methods tend to lack separation of concern'. I agree with this as there is only so much you can do with ternary and null coalescing operators.
Oct 16, 2012 at 14:37 comment added Conrad Frix Oh, well you might want to re-read section 7.4 How long can a routine be, because it doesn't say what you assert it does. In fact it cautions against routines beyond 200 lines, and the OP is asking about a 350 line routine
Oct 16, 2012 at 11:41 history made wiki Post Made Community Wiki by Aniket Inge
Oct 16, 2012 at 10:07 comment added deadalnix @ConradFrix yes.
Oct 15, 2012 at 22:21 comment added Conrad Frix In code complete, it is measured that long methods are sometimes faster and easier to write, and don't lead to maintenance problems Do you mean the book Code Complete by Steve McConnell?
S Oct 15, 2012 at 22:00 history suggested Lee Quarella CC BY-SA 3.0
Grammatical fixes.
Oct 15, 2012 at 21:58 review Suggested edits
S Oct 15, 2012 at 22:00
Oct 15, 2012 at 13:12 comment added deadalnix @da_b0uncer That is also a policy I follow. It is harder to read code than to write it, so extra effort when writing to make code more readable does pay back.
Oct 15, 2012 at 13:10 history edited deadalnix CC BY-SA 3.0
add relevant details from comments.
Oct 15, 2012 at 13:09 comment added K.. I use method names to minimize comments. Which sometimes leads to stuff like "getSelectedNodeWithChildren", but my colleague keep telling me, that my code is nicely readable. I also try to avoid abbreviations, they are nice to write, but not so nice to read.
Oct 15, 2012 at 12:14 vote accept wobbily_col
Oct 15, 2012 at 12:12 comment added Daniel B +1, but I'd still recommend checking the cyclomatic complexity of the long method. High values indicate methods which are effectively impossible to unit test (and long methods are very rarely devoid of control flow logic).
Oct 15, 2012 at 11:46 comment added Joachim Sauer Long method bodies are a classical code smell: it's not in itself a problem, but it's an indication that there's probably a problem there.
Oct 15, 2012 at 11:41 comment added Binary Worrier +1: "No, long methods are not alway bad" but they're nearly always bad
Oct 15, 2012 at 11:37 history answered deadalnix CC BY-SA 3.0