Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Small functions can make code easier to understand—but only when they give a meaningful piece of work a clear name. Don’t split a function just to meet a line-count target. Extract a fragment when a reader would benefit from seeing its purpose at the call site, then make the change in small, behavior-preserving steps.
Why small functions can make code clearer
A well-named function acts like a signpost. It lets someone reading a larger operation follow what happens without first examining every implementation detail. The benefit is not smallness by itself; it is being able to express a useful intention in a name.
As an Amazon Associate I earn from qualifying purchases.
Martin Fowler puts the test this way: “If you have to spend effort into looking at a fragment of code to figure out what it’s doing, then you should extract it into a function and name the function after that ‘what’.” In his Function Length article, he explains that function-size guidance is a proxy for the more important question: when does code belong in its own function? A function name can be longer than its implementation and still make the code easier to follow.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesHow long should a function be?
There is no universal ideal length established by these sources. Fowler says he prefers functions of a few lines, but presents that as his own heuristic, not a rule for every language or codebase.
#1 Best Overall
As context, Fowler described his mostly Ruby website codebase as roughly 15 KLOC in 2016. He reported that about 45% of method bodies were two lines or less, counting non-comment, non-blank lines and excluding the def and end lines. That is an observation about one author’s code, not a benchmark for quality or a recommendation for other projects. The sources do not establish a best function length or independently measure a causal effect of smaller functions on maintainability.
When an extraction helps—and when it does not
Before splitting a function, ask whether the fragment expresses a useful intention that can be named clearly. The name should explain why the code exists, not merely repeat trivial mechanics. Then check whether the caller reads more clearly with the new function in place.
- Intent clarity: Does the name tell the reader what the fragment accomplishes?
- Flow at the call site: Can someone follow the larger task without navigating through needless layers?
- Behavior preservation: Does the restructuring leave observable behavior unchanged?
- Change safety: Can you make and check the change in small steps?
These are practical questions, not a quantified scoring system. If the new name simply restates a minor operation or forces readers to jump around without clarifying the larger flow, the extraction may not improve the design.
A safe, practical way to extract a function
- Find the point of confusion. Locate code that takes effort to understand or obscures the purpose of its containing function.
- Identify the intention. Ask what useful purpose the fragment serves and whether you can give that purpose a precise name.
- Extract and name it. Make the new function’s purpose visible where it is called, so the caller communicates the larger operation.
- Check behavior as you go. Keep the change small and behavior-preserving. Clare Sudbery’s 2020 C# refactoring walkthrough emphasizes having tests in place and compiling and running them at each step.
- Re-read the caller. If the higher-level flow is clearer, the extraction helped. If naming and navigation make it harder to follow, reconsider the split.
Refactoring means restructuring code to make it easier to understand and cheaper to modify without changing observable behavior. The official refactoring site describes small transformations as a way to reduce the chance of error while keeping the system working as the restructuring proceeds. Sudbery’s walkthrough illustrates a practical process; it is not controlled evidence that a particular function size is optimal.
Rank #3
Further reading
If you want a book-length guide, Martin Fowler’s official page lists Refactoring: Improving the Design of Existing Code, second edition, written with Kent Beck and published in 2018. It covers code smells, testing, and practical refactoring techniques. It is optional: you do not need this book or a particular tool to apply the advice here.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




