Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • 42
    +1: "No, long methods are not alway bad" but they're nearly always bad Commented Oct 15, 2012 at 11:41
  • 68
    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. Commented Oct 15, 2012 at 11:46
  • 6
    +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). Commented Oct 15, 2012 at 12:12
  • 11
    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. Commented Oct 15, 2012 at 13:09
  • 4
    @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. Commented Oct 15, 2012 at 13:12