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.
- 7Don't forget maintaining consistent levels of abstraction and good names that ensure peeking inside the methods won't surprise you. Don't be surprised if an entire object is hiding in there.candied_orange– candied_orange2017-06-05 15:43:57 +00:00Commented Jun 5, 2017 at 15:43
- 15Sometimes splitting methods can be good, but keeping things in-line can also have advantages as well. If a boundary check could sensibly done either inside or outside a block of code, for example, keeping that block of code in-line will make it easy to see whether the boundary check is being done once, more than once, or not at all. Pulling the block of code into its own subroutine would make such things more difficult to ascertain.supercat– supercat2017-06-05 16:29:14 +00:00Commented Jun 5, 2017 at 16:29
- 7The "readability" bullet could be labelled "Abstraction". It's about abstraction. The "bite-sized chunks" do one thing, one low-level thing that you don't really care about the nitty-gritty details for when you're reading or stepping through the public method. By abstracting it to a function you get to step over it and keep focus on the big scheme of things / what the public method is doing at a higher level.Mathieu Guindon– Mathieu Guindon2017-06-05 16:32:13 +00:00Commented Jun 5, 2017 at 16:32
- 7"Testing" bullet is questionable IMO. If your private members want to be tested, then they probably belong in their own class, as public members. Granted, first step to extracting a class/interface is to extract a method.Mathieu Guindon– Mathieu Guindon2017-06-05 16:35:01 +00:00Commented Jun 5, 2017 at 16:35
- 6Splitting up a function purely by line numbers, code blocks and variable scope with no concern for the actual functionality is a terrible idea, and I'd argue the better alternative to that is just leaving it in one function. You should be splitting functions according to functionality. See DaveGauer's answer. You're somewhat hinting at this in your answer (with mentions of names and problems), but I can't help but feel like this aspect needs a whole lot more focus, given its importance and relevance in relation to the question.Bernhard Barker– Bernhard Barker2017-06-06 12:52:06 +00:00Commented Jun 6, 2017 at 12:52
| Show 7 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you