Live data from Hacker News

What coding mnemonics do you use?

news.ycombinator.com

41–50 of 88 posts

Re: What coding mnemonics do you use?

#41
I was taught the alligator/crocodile thing like many others, but it never really stuck. For some reason (later in life), someone said "left hand, less than" as they held up their left hand to form a less than sign. That image sticks in my head a lot better.

Another thing that was particularly hard to get naturally was the ternary operator. It didn't sink in easily until Jon Skeet said pretend the ? is indeed a question. If the answer is 'yes', this will happen.

Re: What coding mnemonics do you use?

#42
post #9
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.

Strange one. FYI, "class" has the same meaning in French slang -- probably borrowed from you guys.

I think it's the other way around. I think you guys use _class_ as slang to _classy_: "pertaining to or characteristic of a (high) class," which comes from the literal sense of class, which comes from the French word _classer_.

I didn't know for sure, but I had that feeling knowing that most of the English language is borrowed from others, and not the other way around. (http://www.etymonline.com/index.php?allowed_in_frame=0&searc...)

Re: What coding mnemonics do you use?

#43
post #38
post #36

Earlier quoted context omitted.

I was surprised to see that as an example as well, but then I thought back to starting out as a programmer. I'm sure I spent many hours fixing bugs caused by getting wrong.

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

I remember several kids in my class having great difficulty with when they were first introduced. I can well imagine many of them just decided it was impossible and gave up.

Re: What coding mnemonics do you use?

#45

Not a mnemonic per se but I have melodies for common code snippets. "public static void Main(string[] args)", which is the default method signature for the main method in C#, is a hip-hop beat. SQL statements are always metal tunes. Javascript is usually indie pop.

Just out of curiosity, do you say "array of string" or "strings" or something else?

Re: What coding mnemonics do you use?

#47
post #33
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'

specifically for this one, I have the mnemonic that the side containing the lower value has only one vertex, while the higher has 2 :)

Yeah, the smaller end of the triangle is the smaller number and the wider end is the larger number.

Re: What coding mnemonics do you use?

#48
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'

Interesting. So other people too do get it mixed up. Makes me feel less silly when I find bits of my own code that looks like `x := >- receiverChannel`

I've always thought it's because of carelessness

Re: What coding mnemonics do you use?

#49
post #38
post #36

Earlier quoted context omitted.

I was surprised to see that as an example as well, but then I thought back to starting out as a programmer. I'm sure I spent many hours fixing bugs caused by getting wrong.

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

Re: What coding mnemonics do you use?

#50
I don't use mnemonics in general. For me the effort to remember the mnemonic is actually double that for remembering the thing per se. I need to once remember the symbols->mnemonic connection and then the mnemonic->meaning connection, instead of simply the direct symbols->meaning one. It feels like cluttering my brain with junk that not only doesn't make it easier to remember things, it actively makes it harder.
Post reply on HN