|
|
|
|
|
by snowwolf
4624 days ago
|
|
Just to comment on your example, that method shouldn't exist as it adds no value to the codebase - it is purely redundant code. Especially if you were to rename it to convertTextToUpperCase. The only situation where the method would make sense is if you wanted to be able to change the implementation in the future (TitleCase, LowerCase etc.), in which case a better renaming would be covertTextForDisplayInTitles (i.e. Use the method name to comment why we need to convert the text). That has the added benefit of also telling you what the method does in your IDE just from its signature. |
|
Should a "productive" one liner be put in a separate method / function with meaningful name, or better a comment beside it?
I personally find short methods often decrease code readability, as you constantly have to jump around, and can't read anything from top to bottom.