|
|
|
|
|
by rualca
1831 days ago
|
|
> Does it look wasteful to say that you’re adding a vertical bar when you have the following line of code? It is, if the alternative is to just refactor your code to extract a method so that it reads like: addVerticalScrollBar();
No comment, cleaner code, smaller functions/methods, everything is easier to read and follow and reason about.The main problem with your suggestion is that you're wasting precious space to say the same thing twice. More importantly, your comments adds nothing important or relevant to those reading the code, such as why did you felt the need to add a vertical scrollbars to begin with. That's the sort of thing that's relevant to those reading the code. |
|
As long as the surrounding function is not overly complex, I don't see the advantage of having to jump back and forth from mini function to mini function to understand what the code is doing.