Live data from Hacker News

What coding mnemonics do you use?

news.ycombinator.com

81–88 of 88 posts

Re: What coding mnemonics do you use?

#81

LoVe HAte when ordering psudeo classes in css for anchors* ":link, :visited, :hover, :active" *may not be particularly weird or novel

Also CSS related, when doing margin/padding I use "TRouBLe" to remember: margin: (T R B L)

That's the one I use as well.

Although I can never remember the 3 parameter verision

margin: (T R&L B)

Re: What coding mnemonics do you use?

#82
post #3

I never remember that . = class and # = id in CSS, so I use "say no to drugs" to remember that "hash is not class". Perhaps a mnemonic which only really works in the North East of the UK where 'class' is colloquial slang for 'good'. Also not very good if you smoke pot, I guess.

I remember the difference between class and id by thinking someone is trying to "Pound an idea into your head" or rather "# an id"

Re: What coding mnemonics do you use?

#83
post #54
post #28

The fact that programmers can't remember well illustrates why children shouldn't be chastised for getting (for example) b and d wrong. I have dealt with this by conditioning myself to always read < as 'is less than'

Teacher in elementary school taught me simple rule: signs has two endings on one side and one ending (corner) on another. So two bigger than one and bigger number should be on side with two endings.

Mine taught us that it was an alligator, and it always wanted to eat the bigger number.

Re: What coding mnemonics do you use?

#84
post #76

Earlier quoted context omitted.

It's easy. They're alligator mouths, that always go for the larger number (greedy alligators!)...

This genuinely confused me because I thought the larger number would eat the smaller number.

The alligator is just the symbol, ignoring the smaller number completely.

Re: What coding mnemonics do you use?

#85
post #51

Earlier quoted context omitted.

I find it hard to believe that a statistically normal programmer mixes up . That sounds more like dyslexia.

This is the first time I'm hearing about this too so I think there is more to it. I don't even see why a mnemonic is required since the shape of both ' ' clearly demonstrate the relationship that the operator is testing.

Also a lot of people have trouble with the back and forward slashes. When teaching html, people got the closing slash mixed up, it was all over the place.

Re: What coding mnemonics do you use?

#86
post #38

Earlier quoted context omitted.

I find it hard to believe that someone actually mixes these unless they completely skipped all math classes in school.

Ah, yes the "I can't fit it to my mental model, therefore it is impossible" argument. When little, my brother used to mix up the words "more" and "less" while speaking. I don't doubt someone could mix up > and <.

Yeah people frequently mix up left and right also. And my brother always wrote his numbers backwards or rather left to right (units on the left).

Re: What coding mnemonics do you use?

#87

Earlier quoted context omitted.

I find it hard to believe that a statistically normal programmer mixes up . That sounds more like dyslexia.

I've known a few otherwise non-dyslexic programmers that have had this issue. One guy kept a sticky note on his monitor with "> Greater, < Less" written on it.

I find that really fascinating. Was it just those things? What about which paren (or brace) opens and which one closes? (I'm not being facetious!)

Re: What coding mnemonics do you use?

#88
post #35

\r\n or \n\r? ReturN - R before N

Carriage Return is first because it takes much more time for the carriage to go back to the column 0 from the column 79, than for the paper to Line Feed one line. So while the carriage is flying back, the paper can feed, and hopefully we won't have to wait too much time for everything to be ready for a new line. Or we may always insert some Nul codes to wait.
Post reply on HN