Live data from Hacker News

What coding mnemonics do you use?

news.ycombinator.com

1–10 of 88 posts

Re: What coding mnemonics do you use?

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

Re: What coding mnemonics do you use?

#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 to right), the opening is "greater than" the point (and the symbol means "greater than"). .

Re: What coding mnemonics do you use?

#5
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…

I don't know if this is common, but I visualise numbers on a line which makes it amazingly easy to use the 'arrows' metaphor

   
1 2 3 4 5

Re: What coding mnemonics do you use?

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

Re: What coding mnemonics do you use?

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

Re: What coding mnemonics do you use?

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

Re: What coding mnemonics do you use?

#10
post #5
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…

I don't know if this is common, but I visualise numbers on a line which makes it amazingly easy to use the 'arrows' metaphor 1 2 3 4 5

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