Hacker News new | past | comments | ask | show | jobs | submit login

It seems like a reading micro-optimization to me, though. Surely most of the delays in understanding code lie in things other than "Yoda" conditionals. I'm going to guess complexity elsewhere in the code (even conceptual difficulties, such as "what is the purpose of this at all?") dwarf minor details like how one writes conditionals. If so, what is the point of this piece of advice?



> It seems like a reading micro-optimization to me, though.

It's a "reading micro-optimization" in the same way that not littering your code with comments is a "reading micro-optimization".

It makes you pause and interrupts your flow of thought as you contemplate something not directly related to what you were modeling in your head 2 seconds ago.


I don't think it's the same. I'm not arguing against code cleanliness or good practices. Code readability matters. I favor concise, expressive languages over verbose ones for precisely this reason.

Littering your code with comments IS a huge readability problem. You are forced to filter them out to find the real code, since they are mostly garbage, but you can never be sure you aren't skipping some vital bit of information. Likewise, boilerplate and needless ceremony obscure the intent of the code, so they are obstacles to be reduced in good, clean code.

Contrast this with writing Yoda conditions. They are no big deal. They interrupt your flow of thought exactly once: the first time you encounter them. If your train of thought is interrupted every time you encounter them, you are way too novice a programmer. So I think this is a really minor issue in the sea of software complexity; so minor, in fact, that it seems bizarre to me to mention it.

I think whether to use Yoda conditions, much like the placement of braces or the number of whitespaces for indentation, are the stuff of flamewars and endless argument because they are the kind of things we programmers love to obsess about, but they are really not very important.


> If your train of thought is interrupted every time you encounter them, you are way too novice a programmer.

You're unimaginative.

This conversation is finished.


This comment breaks the HN guidelines. If you don't have something civil and substantive to say, please don't post.

https://news.ycombinator.com/newsguidelines.html


please stop following me around dang. One would think you would be warning the person who implied I was a novice programmer, but that would require consistency and fairness.

either ban me or leave me alone until I do something that's actually ban worthy please.

And to be clear, so there is no confusion here.

Your guidelines state the following:

> When disagreeing, please reply to the argument instead of calling names. E.g. "That is idiotic; 1 + 1 is 2, not 3" can be shortened to "1 + 1 is 2, not 3."

According to your guidelines, his comment:

> If your train of thought is interrupted every time you encounter them, you are way too novice a programmer.

Should have been something such as:

> If your train of thought is interrupted every time you encounter them you probably don't see yoda conditionals very often.

Please, do me favor, go warn him as well.

consistency and fairness.

Or just ban me since we both know that's what you want to do.


I apologize if I offended you. I didn't mean "you" as in "you, mreiland", but as in a generic "you". I can no longer edit my post, but I've no problem if an admin edits that part to make it more explicitly general.

My use of "you" was the same as yours when you said "it makes you pause and interrupts your train of thought"; I didn't take it to mean you were referring to me specifically! Unfortunately written language is prone to this kind of misunderstandings :(


I have no issues with the way you worded that, I would have defended you had dang stepped in to complain about it (and in fact I've done exactly that in the past, which is when dang started harassing me). I was more pointing out the hypocrisy of dang.

I ended the conversation for exactly the reason I cited, a distinct lack of imagination. Anyone who immediately reaches for "you must be a novice programmer" isn't really someone I'm interested in conversing with.

Especially since anyone who stopped to think about it for more than two seconds would realize a "novice programmer" would find the yoda conditionals easier specifically because they're still learning to read code.

No one in their right mind would claim an adult reader would be better at having random bits of text in their novels read from right to left in the middle of their left to right text. Most reasonable people are going to agree that it's easier for a young person just learning to read to pick up on that.

Yet there you were, making exactly that claim for programming.

It indicated a reactionary comment with a complete lack of critical thinking on your part and I just have no interest in spending my time speaking with a person whose thought processes work in that manner.

And if that offends you, then so be it. I personally do think you were simply being passive aggressive and that's why you didn't stop to think about what you were actually saying.

Which is your right to do, and I would defend you for it. But it doesn't mean I'm willing to continue engaging you.


Your comments suggest that you feel this is personal. It isn't. You just need to follow the rules like everyone else.

Inconsistencies in HN moderation are random side-effects of the impossibility of reading all the threads. You're welcome to bring them to our attention, but please don't take them personally.


> Inconsistencies in HN moderation are random side-effects of the impossibility of reading all the threads.

Unless it's one of mine, of course. Then you seem fairly consistent.

ban me or leave me alone.


Ok, we've banned you. When you're ready to follow the rules like everyone else, you're welcome to email hn@ycombinator.com and get unbanned.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: