git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/5] grep: perform some minor code and comment cleanups

From
DSDragan Simic <dsimic@manjaro.org>
Date
Mar 19, 2024, 05:33 UTC
Message-ID
<24093dca675c49cfde39f6d6efca2342@manjaro.org>
In-Reply-To
<xmqqjzlzt61d.fsf@gitster.g>
On 2024-03-19 01:32, Junio C Hamano wrote:
Show 11 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
> 
>> It's entirely subjective, of course, so no right-or-wrong answer, but
>> I personally do not find that this change improves code quality or
>> readability.
> 
> I agree that this is entirely subjective.  To those who wrote these
> variable decls and inits, what they wrote was the most readable,
> wasn't it?  It probably falls into the "to some readers the existing
> code may not be perfect, but once it is written, it is not worth a
> patch noise to fix it" category.

There's no doubt that it was the most readable form to the people who wrote the code, which was some time ago, but the time inevitably passes and the surrounding code changes over time, maybe even some new coding guidelines become introduced, etc.

Things inevitably change, that's all I'm trying to say.
Show 18 quoted lines
>> With my reviewer hat on, I spent an inordinate amount of time staring
>> at this change trying to locate each variable's new location to verify
>> that no initializers were dropped and that the declared type hadn't
>> changed.
> 
> It is true that "cleaning up, no behaviour changes intended" patches
> are unpleasant to review.  They are boring to read, and the risk of
> breakage due to mistake is unnecessary and severe.
> 
> But if the result is objectively better, such a one-time cost may be
> worth it.  We are investing into the better future.  For example, we
> may have an unsorted mess of an enum definition, and we do
> appreciate in the longer run, such a definition were "more or less"
> sorted within the constraint of some other criteria (like, "errors
> get negative value").  If the enum is a huge one, it may need some
> careful reviewing to verify such a change that turns the unsorted
> mess into a sorted nice list, but the cost of doing so may be
> justified.

I fully agree that reviewing code-cleanup patches it usually boring and often taxing. I mean, why change something that has served us well for years, just to make it look nicer in someone's eyes? What does even "nicer" mean to everyone?

Well, I sometimes look at the code as if it were a beautiful painting. To some people, it doesn't matter if a painting has some rough areas, as long as it can be hung on a wall. To them, it's just a square thing. Though, to some other people, spotting such rough areas is what makes the painting less beautiful to them. Paintings usually cannot be fixed easily, but fixing the code is much easier.

Of course, "nicer" is very hard to define, but I believe that, in the domain of computing, it could be partially defined as "more consistent and flowing better". That's what I tried to achieve with this patch, and I hope I've managed to convey my viewpoint.

> Does the change in this patch qualify as "objectively better"?  I
> dunno.

I'd say that these changes qualify as "semi-objectively nicer", but surely not as "objectively better". For any changes to be objectively better, they'd need to introduce some functional changes to the code, while a well-performed code cleanup actually introduces no functional changes.

Previous: Junio C HamanoNext: Dragan Simic
Message 17 of 22 in “New config option for git-grep to include untracked files”
  1. 0/5 New config option for git-grep to include untracked filesDragan Simic, Mar 18, 2024
  2. 3/5 grep docs: describe --no-index furtherDragan Simic, Mar 18, 2024
  3. Junio C HamanoMar 19, 2024
  4. Dragan SimicMar 19, 2024
  5. 4/5 grep: introduce new config option to include untracked filesDragan Simic, Mar 18, 2024
  6. Junio C HamanoMar 19, 2024
  7. Dragan SimicMar 19, 2024
  8. Junio C HamanoMar 19, 2024
  9. Dragan SimicMar 19, 2024
  10. 2/5 grep docs: describe --recurse-submodules further and improve formatting a bitDragan Simic, Mar 18, 2024
  11. Eric SunshineMar 18, 2024
  12. Dragan SimicMar 18, 2024
  13. 1/5 grep: perform some minor code and comment cleanupsDragan Simic, Mar 18, 2024
  14. Eric SunshineMar 18, 2024
  15. Dragan SimicMar 18, 2024
  16. Junio C HamanoMar 19, 2024
  17. Dragan SimicMar 19, 2024
  18. 5/5 grep docs: describe new config option to include untracked filesDragan Simic, Mar 18, 2024
  19. Junio C HamanoMar 19, 2024
  20. Dragan SimicMar 19, 2024
  21. Junio C HamanoMar 19, 2024
  22. Dragan SimicMar 19, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.