Live data from Hacker News

What coding mnemonics do you use?

news.ycombinator.com

51–60 of 88 posts

Re: What coding mnemonics do you use?

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

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.

Re: What coding mnemonics do you use?

#52
post #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?

Actually, I say "string" and then drop the bass for the square brackets.

Re: What coding mnemonics do you use?

#53

Earlier quoted context omitted.

That seems ambiguous to me in several ways. There must be more semantics you are subconsciously depending on to clarify it.

I think he means that he visualizes the pair " " relative to a line of numbers. Similar to how he placed it above a line of numbers in his ASCII art. points up (right) to numbers that are greater than. Makes perfect sense if you are a visual thinker.

Exactly this - thanks for clarifying my explanation

Re: What coding mnemonics do you use?

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

Re: What coding mnemonics do you use?

#56

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)

My one is visualising a clock face, 12, 3, 6, 9

Re: What coding mnemonics do you use?

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

I used to mix it up in elementary school because the school teacher explained that "" is "more". Even worse, she suggested to memorize it like this: |At some point I realized it's possible to memorize it visually, since then I never mixed it up again

Re: What coding mnemonics do you use?

#58
post #7
post #4

You might try a visual trick. Note that look like "arrows" and "point" in a particular direction. There is a small end (the tip/point) and a large end (the open end). The vertical size of the point is "less than" the vertical size of open end. So if the point comes first (reading left to right) then the point is "less than" the opening (and the symbol means "less than"), but if the opening comes first (reading left t…

Imagine the arrows are crocodiles. They always try and eat more. 1 4 > 1 If they're eating less, they're not happy crocodiles.

Or the "is greater than" (>) is a crocodile's mouth, and "is less than" (<) is a bird's beak. The bird eats smaller food than an crocodile eats, and the crocodile eats bigger food than the bird eats.

Re: What coding mnemonics do you use?

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

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