You move to a new city and you don’t know where the nearest grocery store is.
You don’t beat yourself up — it’s normal. You just use Google Maps to find it.
After you’ve been there several times, it’s highly likely that you won’t need to use Google Maps.
It’s the same with other places, like the nearest restaurant, or sports center — at first, you perhaps need to use Google Maps, then you learn the locations yourself and no longer need to use it.
You learn them but it’s not that you’re intentionally trying to memorize every road, every possible path to a certain destination.
There can be cases when you are only interested in going there once.
It’s the same with certain methods that you may need to use in a programming language.
New software developers may feel bad that they’re not memorizing sufficient syntax — they still need to refer to the documentation. They see this as a sign that they’re bad developers.
Here are a couple of common questions they may have when they start their journey into programming:
- How should I be able to learn all this syntax?
- How long will it take for me to master it and write without referring to the documentation?
When they’re able to memorize some frequently used syntax, they may think that they’ve become good at programing.
They get the impression that it’s the amount of a language or the number of programming languages and frameworks they are able to memorize that really matters.
To put things in perspective, let’s compare the syntax of finding the length of a string in different programming languages:
seq.length
, JavaScript lists, Java arrays.seq.size()
, Java sequences, jQuery expressions (deprecated).len(seq)
, Python.seq.count()
, Django querysets.SeqType'Length
, Ada arrays.length seq
, Haskell.(count seq)
, Clojure.sizeof(seq)/sizeof(seq[0])
, C, statically allocated.strlen(seq)
, C, null-terminated.
As you can see, each language or technology has its own version of finding the length of a string. This is an indicator that it’s really difficult to memorize the same function in 12 alternatives.
It’s very unlikely that a developer who’s used multiple programming languages can memorize all the syntax that they have used in the past. They may even not bother trying to learn it in the first place.
Is Syntax So Important That I Have to Memorize It?
To answer this, let’s check what some senior developers say.
I wrote 255 lines of code that included a working server and a client. I queried google 23 times mostly landing on StackOverflow, Netty 4 website, GitHub, and JavaDocs. If you do the math, that averages out to 1 query every 10 lines of code! I had no idea.
Umer Mansoor
These admissions should give you courage — you don’t have to be ashamed that you can’t remember every detail of the syntax.
This is something that many junior developers may be concerned about. The truth is, you really do not have to memorize everything as you go.
Not even tech recruiters care about that. Here’s the response that an engineering director at Google gave regarding this:
Here’s another quote from a comment on Hacker News:
I not only use Google frequently, I use it to search for things I myself have written in the past.
I can’t count the number of times I’ve Googled for a programming question where the answer is found on a Stack Overflow page I’ve written. If it’s a particularly old answer that I’ve completely forgotten, I’ve even thought to myself, “Wow this genius sounds just like me!” as well as “This idiot has no clue what he’s talking about!” .
A couple of months ago, I read a post on a Facebook group from a senior developer mentioning that when recruiters ask him whether he has experience with a particular technology for which he hasn’t, he responds, “That’s just another tool.”
Meaning that I may not have had the chance to work with it in the past but I have the confidence that I can learn it.
I may not need to spend months before I am able to work on it. I may only need a few hours to read its documentation and then learn more as needed along the journey without the need to memorize everything.
You do not expect to have all green lights on when you start your journey to your destination. You pass through the current green light and stop at a red light. You wait until the green light is on before proceeding.
Nowadays, we get new languages and frameworks, or considerable changes to existing ones, so that trying to memorize the syntax is both difficult and not that important. As one commentator on a blog post brilliantly put it:
“Great engineers know how to formulate good queries. Yet interviewers expect walking dictionaries.”
Note: I have already published a short portion of this article in this blog before, but I decided to include it here.