logoalt Hacker News

gitremoteyesterday at 9:38 PM1 replyview on HN

> The most effective contributors at your job remove more code than they add?

Yes.

> That doesn't sound effective that sounds like digging ditches to fill them.

It sounds effective to me, like removing garbage from sidewalks so people can walk straight instead of walking around the trash.

> Every line of code removed is a line that was previously added.

Correct. Today I cleaned up

  if (a || b)
    return true;
  if (c)
    return true;
  if (d)
    return true;
  return false;
to

  return a || b || c || d;
and contributed various other negative lines of code in multiple areas.

Every line of code removed is a line that was previously added.

Do you have any experience coding before LLMs?


Replies

saltcuredyesterday at 10:51 PM

Written exactly like that, yours is obviously cleaner.

But, if that original code had comments and traceability of each condition and return to a specific domain scenario, you would be doing a disservice by collapsing it to the one flat boolean expression. In that case, it may be better in its expanded form, and you should let an optimizing compiler do the collapsing.