Live data from Hacker News

What coding mnemonics do you use?

news.ycombinator.com

11–20 of 88 posts

Re: What coding mnemonics do you use?

#11

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.

I also have a melody for the default method signature in Java which is the same except a slight difference in case "public static void main(String [] args)"

Re: What coding mnemonics do you use?

#13
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 use the same visual trick (more or less, looking at as arrows, or if you want, spears) but I visualise bigger numbers as more "powerful" numbers that poke the "weak", smaller numbers with the pointy bit :D That's how I imagined them when I was a small child and that's how I still "see" them :D

Numbers are cruel and ruthless :)

Re: What coding mnemonics do you use?

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

You can make it even simpler than that: just put the big number next to the big end of the glyph and vice versa.

Re: What coding mnemonics do you use?

#15

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.

I also have a melody for the default method signature in Java which is the same except a slight difference in case "public static void main(String [] args)"

Please tell me you guys are actually singing the signature to a particular tune in your head like people sing the ABC song when they recite the alphabet. Because that is adorable.

Rapping arbitrary chunks of code could be a fun after-hours conference game.

Re: What coding mnemonics do you use?

#16

Earlier quoted context omitted.

I also have a melody for the default method signature in Java which is the same except a slight difference in case "public static void main(String [] args)"

Please tell me you guys are actually singing the signature to a particular tune in your head like people sing the ABC song when they recite the alphabet. Because that is adorable. Rapping arbitrary chunks of code could be a fun after-hours conference game.

You're partially correct. I do sing them, not necessarily in my head.

Re: What coding mnemonics do you use?

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

Oh, I didn't realise anyone didn't remember it that way! I remember being taught it, but just assumed everyone else was, I guess.

Re: What coding mnemonics do you use?

#18
post #5

Earlier quoted context omitted.

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.

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