pcouy

joined 2 years ago
[–] pcouy@lemmy.pierre-couy.fr 4 points 8 months ago (3 children)

When refactoring, it's often the "what" that changes, not the "why"

[–] pcouy@lemmy.pierre-couy.fr 4 points 8 months ago* (last edited 8 months ago) (5 children)

I'm not sure how we disagree. At least, I don't disagree with you. My whole comment was talking about "what" comments. "Why" comments are a very good thing to have where they're needed

[–] pcouy@lemmy.pierre-couy.fr 6 points 8 months ago (7 children)

That's not what I said. I said that comments can often (but not always) be replaced with good and explicit names.

This can be pushed to some extreme by making functions that only get called at a single place in the code, just for the sake of being able to give a name to the code that's inside (instead of inlining it and adding a comment that conveys the same informations as the function's signature)

It's definetly not for everyone, but for beginners/juniors it gives something objective they can aim for when trying to build good coding habits

[–] pcouy@lemmy.pierre-couy.fr 4 points 8 months ago* (last edited 8 months ago)

Apart from the fact that, as another commenter said, "smells" are not "rules", I think most of these points come down to developing good habits, and ultimately save a lot of time in the long run by initially spending some time thinking about maintainability and preventing/limiting technical debt accumulation.

[–] pcouy@lemmy.pierre-couy.fr 5 points 8 months ago (9 children)

It's often a good idea to make the code itself very explicit through verbose function and variable names, rather than writing comments that could lead to inconsistencies between code and comments (by not updating the comments at the same time as the code) (see "Fallacious Comments" from the catalog)

[–] pcouy@lemmy.pierre-couy.fr 2 points 8 months ago

They are both serialization formats that are supposed to be able to represent the same thing. Converting between these 2 formats is used in the article as a way to highlight yaml's parsing quirks (since JSON only has a single way to represent the false boolean value, it makes it clear that the no value in yaml is interpreted as a boolean false and not as the "no" string)

Anyway, I disagree with your point about YAML and JSON not being interchangeable

[–] pcouy@lemmy.pierre-couy.fr 2 points 8 months ago (1 children)

Did you find the article stupid, or are you talking about yaml parsing ?

[–] pcouy@lemmy.pierre-couy.fr 7 points 8 months ago (2 children)

The problem is specifically that in't not exactly clear what's considered ambiguous. For instance, no is the same thing as false, but as evidenced in the linked post, in the context of country codes, it means "Norway" and it's not obvious that it might get interpreted as a boolean value.

It's the same thing as this famous meme about implicit type conversions in JS :

[–] pcouy@lemmy.pierre-couy.fr 7 points 8 months ago (4 children)

In any almost other context (where boolean values exist), strings must be delimited by quotes, eliminating the ambiguity with false as string contents and the false boolean value

[–] pcouy@lemmy.pierre-couy.fr 26 points 8 months ago (6 children)

I think most open-source contributions come from a tiny fraction of users who initially get involved because they want to improve the project or fix a bug for their own usage

[–] pcouy@lemmy.pierre-couy.fr 35 points 8 months ago

ENS stands for Ethereum Name Service

[–] pcouy@lemmy.pierre-couy.fr 3 points 8 months ago

"ENS domain"

IPFS is also strongly related to several blockchain stuff (not a blockchain itself though)

view more: ‹ prev next ›