Live data from Hacker News

How to reduce the cognitive load of your code

chrismm.com

231–239 of 239 posts

Re: How to reduce the cognitive load of your code

#231
post #59

Like often with this kind of article it barely scratches the surface. "null != variable" will confuse people is downright silly. People confused by this won't have an inkling of what any non-hello-world program does. The rest has some validity, but it focuses on syntax and programming in the very small. It might take a bit of effort, but I can make sense of a tangled function (that's not an excuse to code sloppily th…

Replying to myself, to say that it is interesting how must people replied to this to comment about the "null != variable" thing.

Kinda makes my point.

I suppose it could be explained by the fact that it's much easier to say something about the intuition of "null != variable" than to share some architectural insight.

Re: How to reduce the cognitive load of your code

#232
post #198

Earlier quoted context omitted.

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 infor…

> 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

Re: How to reduce the cognitive load of your code

#233
post #232

Earlier quoted context omitted.

> 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.

Re: How to reduce the cognitive load of your code

#234
post #232

Earlier quoted context omitted.

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…

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 :(

Re: How to reduce the cognitive load of your code

#235
post #234

Earlier quoted context omitted.

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…

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…

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.

Re: How to reduce the cognitive load of your code

#236
post #232

Earlier quoted context omitted.

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…

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.

Re: How to reduce the cognitive load of your code

#237
post #162

Earlier quoted context omitted.

I agree with everything you said. As an old Perl guy, I found it hilarious that Perl has a reputation for illegibility, while I find it easier to read than most Java, because in Perl I can express my intent, and in Java it's buried in the noise. One cognitive problem I've not yet found a good solution to: So I have a high level routine to, say, sort the items in a display. Said sorting has some cascading effects, so…

One approach that can help is to name things based on what the functions actually do. validateSortDisplayedItems { validation Logic ... sortDisplayedItems(); //Actually sorts items. } This can be harder to maintain, but really long names end up a useful code smell.

[deleted]

Re: How to reduce the cognitive load of your code

#238
post #236

Earlier quoted context omitted.

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…

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.

Re: How to reduce the cognitive load of your code

#239
post #236

Earlier quoted context omitted.

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.
Post reply on HN