Hacker News new | ask | show | jobs
by cirrus3 1274 days ago
> There's something elucidating (and satisfying) in seeing a non-obvious piece of code in your native style.

Not 5 years later, and when it is someone else's code. Just don't. Initialisms are no better than single char var names. No one later is going to know you started naming "SmartFooProcessingThing" as "sfpt" and when they search for it in millions of lines of the codebase, they are gonna come up empty and waste time.

There is nothing you should be finding "satisfying" in a non-obvious piece of code. And if you are working on team, there should be nothing "in your native style". Don't be that person.

1 comments

I don't think we're talking about the same things.

> Not 5 years later, and when it is someone else's code. Just don't.

That's precisely when you rewrite more: when the initial context is gone.

> Initialisms are no better than single char var names.

Correct.

> No one later is going to know you started naming "SmartFooProcessingThing" as "sfpt" and when they search for it in millions of lines of the codebase, they are gonna come up empty and waste time.

They're not meant to be grepped for. They're meant to be local, fleeting, names for something.

> There is nothing you should be finding "satisfying" in a non-obvious piece of code.

There is. When you understand it, it's satisfying. Or so has been my experience. There's also the frustration of "why was this left like this in the first place", but sometimes it's merely a matter of preference.

Please note that I'm advocating for rewriting and throwing away things you don't understand, not for leaving puzzles for others to relish on.

> And if you are working on team, there should be nothing "in your native style". Don't be that person.

Indeed.