Is it common? Does it happen to you too? Share your most embarrassing story.
Constantly (after almost 20 years of coding experience). And now, after getting used to using Intellisense, even more. When I have to remember the syntax of something without the help of Intellisense, many times I end up Googling it. But it is nothing to worry about. The most important skill to be a good programmer is problem-solving. If you are good at that, you can afford to forget the syntax ;)
So tips to help:
- Listen to your editor (if there is a warning look it up): most editors come with syntax check, auto-completion and recommendations
- Lint your code: this is the best way to catch syntax best practices
- Test your code: without tests you can't assess if it's working and when it doesn't tests show you where it is
- keep a library of docs for the languages and frameworks you use: I use dash on my Mac for that.
Yes and no. This mostly happens if I'm working with a language I haven't worked with for some time. However, since I spend most of my time in C, it doesn't happen very frequently because programming in C is one big black-out in general and it's so primitive that the skills easily translate to other languages...
You can usually do things the "C way" in any language but the newer languages offer more syntactic sugar... So this means if I can't remember how a generator or some other higher-level contract works, I can just do a manual loop the old-fashioned way. I have blackouts all the time when it comes to remembering higher-level constructs.
I spent hours before I figured out that a React component's name had to start with an uppercase alphabet. I had joint my first team ever and was asked to explore ReactJS for a week and then given a knowledge transfer session to the team to share what I'd learnt.
I was shit scared on the first day when I couldn't even make run a hello word React Component. When I figured out what was wrong in the latter part of the day, rather than laughing, I questioned my sanity 😛. I was like
I'll never be able to finish in time 😅