2

There are two related syntaxes in a common programming language. I keep on failing to memorize the order of operand and keyword; I always have to look it up.

There may be an explainable reason for that transposition. Someone even may know an actual “mnemonic saying” to remember it.

So, my question is about programming, and it might be answered, not just discussed. On the other hand, it surely may be considered “primarily opinion-based” and it is also not about an actual coding problem, but about a syntax specific that is not (ana)logical.

Is it OK to ask for a mnemonic of code syntax on Stack Overflow?

7
  • Clarify mnemonic of code syntax please. Commented Aug 15, 2015 at 12:23
  • 2
    The order of operand and keyword is fact enough for the question to stand on its own. But such words as "mnemonic" may do little more than trigger kneejerk close votes regardless of the merit of the question. I'd say just ask plainly what the order is to be safe.
    – BoltClock Mod
    Commented Aug 15, 2015 at 12:26
  • 1
    Sorry, I’m not sure about “mnemonic” as an English word, but the respective Wikipedia article describes it properly. How do you call it in English? Anyway, imagine there’s 123.add() and substract(123) both built-in, but the syntax between operand and function is not interchangable, while both methods are (arithmetically) related.
    – dakab
    Commented Aug 15, 2015 at 12:27
  • @BoltClock: I know what the order is (as documentations show), but I just can’t remember it, because it is not analogous, hence the question would be why this was so and therefore may be not eligible for Stack Overflow.
    – dakab
    Commented Aug 15, 2015 at 12:36
  • 1
    To me it is clear what your asking. And the answer is no, it is not on topic for StackOverflow. You are asking a specific question about a more general topic How can I more effectively remember things?
    – robbmj
    Commented Aug 15, 2015 at 20:39
  • To address your underlying issue, learn the mechanics of the language, and then the operand order will not be surprising at all. For example, RPN ("Reverse Polish Notation") makes perfect sense when you understand that its operators act on operands already on the stack.
    – Ben Voigt
    Commented Aug 16, 2015 at 2:54

3 Answers 3

10

If what you're really looking for is a mnemonic device, a memory aid, your question will probably be closed as primarily opinion based.

Mnemonic devices tend to be somewhat person specific, as in what helps me remember may not help you remember, so the chances of there being one clear correct answer are slim to none.

These questions are just too subjective and will probably boil down to a list question, much like "What’s your favorite ______?"

1
  • 2
    Surely there are still some that are less subject to be “person-specific”, like the “knuckle mnemonic”, so there might be a chance here for that, too.
    – dakab
    Commented Aug 15, 2015 at 20:43
2

There are mnemonic/memory forums on the internet where you can ask for help in formulating mnemonic devices for something you need to remember.

That being said, before you go that far, make sure you're not missing some underlying logic (that you might not yet understand about the ordering of those parameters). I realize that in Java for example, this kind of ordering can be very subtle and nonsensical to beginning Java developers, but there is usually a logic to it. This is where StackOverflow can help, or books like Thinking in Java by Bruce Eckel (for intermediate Java developers), or Head First: Java by Kathy Sierra (for beginners). Hopefully, there are similar highly rated books for the particular language you're trying to learn.

Also, I'd suggest you focus on learning the core builtin functions of your language that are the most useful for your work. Don't bother learning third-party apis that are likely to change in the future, or that are less likely to be consistent in their syntax. That's what the documentation is for.

That being said, I'd suggest you use Anki flash cards and spaced repetition to memorize and constantly review programming syntax. That's what I use. Just don't start copying vast amounts of flash cards from other people, or you will easily lose yourself in them. You'll need to create your own from scratch, based on your actual daily use and daily learning. That is the most effective way I found.

1
  • The same thing happens with respect to the order of English adjectives. Practice enough and you learn that saying "the Southern ginger gay tall teacher" doesn't sound quite right. Commented Jan 20, 2018 at 15:47
-2

I originally disagree with the comments and answers given here, but have came around to the consensus. Here're my $0.02.

I recently came across this closed question - How to remember order of parameters to ln command?. This is a problem I've had for a long time, and the answer has helped me remember the order of the arguments to ln. So I wished the question wasn't closed.

This question is a common and "specific programming problem", and also "a practical, answerable problem that is unique to software development". These are two of the criteria for an on-topic question. Just because there are many ways to answer a question doesn't mean it is not on-topic.

What makes it off-topic is the fact that the answer given may help some people and not others, and so it can never be an objectively-correct answer.

However, you can still upvote the question / answer because it helped you, despite being off-topic.

2
  • I can recite the first 8 digits of my social security number but I always forget the last two digits. That's the same thing – so it's not a "specific programming problem", not "unique to software development".
    – Jongware
    Commented Jan 20, 2018 at 15:18
  • It's different, remembering your social security number is a problem specific to you. Remember a common command line tool is a problem common to many programmers. And if you need help remembering your social security number, just send it to me, I'll help you remember :p (same goes for credit card numbers)
    – d4nyll
    Commented Jan 20, 2018 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .