A couple of years ago I've read a blog post somewhere, where the author said that they always use < or <= and never > and >=.

So instead of:

if v.len() > MAX_ALLOWED_SIZE {

which is written the way one would say it: "if the length of v is greater than allowed ...", to use:

if MAX_ALLOWED_SIZE < len.size() {

which instead of trying to be a transliteration, puts the sides in the natural order, like in:

0, 1, 2 3, 4 ...

I got curious if doing it this way is beneficial, and half-consciously tried it out. And I got hooked, and highly recommend it to everyone.

I think the main reason why it works is that it effectively eliminates one complication. I look at the comparison and don't have to parse which way is the operator pointing and interpret it. I don't have to "read it in my head". I just look and "left is lower", "right is higher". Simple.

The only downside is that now seeing > in code that I did not write, annoys me a bit. I still immediately notice that "it points to the wrong side", and have can figure it out fast, but having to think about it seems inconvenient.

That's kind of it. ~~I can't find the original blog post (was it maybe a reddit comment or something?)~, but if you do, please send it my way and I would put the link below.~~ You can find the original blog post here (thank you Johannes!).