What weird coding things do you have to use statements for or other weird tricks to remember? I can never remember < or >, and only remember that < is less than from years of typing (i=0; i<30; i++).
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.
Normally, this would honestly be a moment when I'd question if you were trolling, maybe post the fry meme image.. but. Given the topic, I actually believe you O_O
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.
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_.
When I was in grad school a friend in another department said "You guys in CS have much nicer printers; can I mail you my thesis and have you print it out? And how would I mail it?" I said "Sure; Just do 'mail me@school.edu less-than-symbol filename". Later he calls in a panic -- "my thesis file has disappeared! I did what you said ... oh, wait a minute, I might have done greater-than instead of less-than..."
Fortunately for both of us, he had been diligent about making backups and din't lose his entire thesis.
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 '<' and '>' clearly demonstrate the relationship that the operator is testing.
I probably should have chosen a better mnemonic to start from! I'd point out that if you see greater and less than more like arrows it's utterly confusing. I'm not denying I'm probably weird in that respect, it's just something I have to use tricks to remember….
Also a lot of people have trouble with the back and forward slashes. When teaching html, people got the closing slash mixed up, it was all over the place.
I've known a few otherwise non-dyslexic programmers that have had this issue. One guy kept a sticky note on his monitor with "> Greater, < Less" written on it.
I used to mix it up in elementary school because the school teacher explained that "<" is "less" and ">" is "more". Even worse, she suggested to memorize it like this: |<leiner = kleiner (german, meaning less)
At some point I realized it's possible to memorize it visually, since then I never mixed it up again
I remember several kids in my class having great difficulty with < and > when they were first introduced. I can well imagine many of them just decided it was impossible and gave up.
Was it possible to give up? In my place, they wouldn't be let on to the next grade if they'd fail basic math - i.e., they'd spend the summer repeating it + an extra year in the same grade if that wasn't enough; so it would have to be a real exception to see a 10 year old who can't somehow manage that.
Anyways, the classic mnemonic for that was simple - for < and > the wide part contains more 'thingies' than the narrow part. They're actually taught before numbers or together with numbers, like [pic of four strawberries] > [pic of three strawberries].
I was taught the crocodile thing, but had real issues with it: I can think it through but it's not fast. I'm pretty much ambidexterous (i.e. write with left and catch a ball with my right) so while I can do quite a lot of things with both hands I also have problems with left and right!
Teacher in elementary school taught me simple rule: signs < and > 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.
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`
Thats a nice example showing that mnemonics need not be logical to have value (if you asked people to order the numbers on a clock face, I think the vast majority would have them as 3, 6, 9, 12)
I really don't see what the big deal is with tar. Everyone seems to hate it. Probably because exactly one of those flags is necessary: zcat merc.tgz | tar -x
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.
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").
.
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.
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.
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
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.
The trick with typedef is it is exactly the same syntax, in all cases, as declaring a variable of that type. This is essentially the only way you're going to ever remember how to do function pointer typedefs: typedef int (function_t)(int,int); // or something to that effect
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.
Carriage Return is first because it takes much more time for the carriage to go back to the column 0 from the column 79, than for the paper to Line Feed one line. So while the carriage is flying back, the paper can feed, and hopefully we won't have to wait too much time for everything to be ready for a new line. Or we may always insert some Nul codes to wait.
"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.