Re:What coding mnemonics do you use?
by pwg on Wednesday August 07, 2013 @06:41AM
(#6171895)
You might try a visual trick. Note that < and > 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").
.
[ Parent
| on HN ]
Imagine the arrows are crocodiles.
They always try and eat more.
1 < 2
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.
Or maybe as snork-eater-eaters
http://wharble.com/sites/default/files/Snork-Eater_Eater.jpg
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 5That 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 down (left) the row of numbers to numbers that are less than the other ones and > 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?
by JonnieCache on Wednesday August 07, 2013 @07:40AM
(#6172100)
You can make it even simpler than that: just put the big number next to the big end of the glyph and vice versa.
I use the same visual trick (more or less, looking at < and > 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 :)
I'm not convinced programmers even need a mnemonic for < and >. After all, they'll read and write those glyphs millions of times in their lifetime.
Re:What coding mnemonics do you use?
by JonnieCache on Wednesday August 07, 2013 @08:13AM
(#6172230)
At least for me, the metaphors that I used to learn the symbols as a child have become my enduring mental models of those constructions, even if they're not actually needed to recall them any more.