Hello Everyone!
So i wanted to know if its a bad practice or its absolutely normal looking up syntax as i code or i am meant to know syntax offhand without looking it up.
As an experienced programmer, how often do you look up syntax?
PS: Question updated, i mistook Functions/API for syntax...
As a developer, you're not just limited to one specific languages. You may gradually learn sorts of languages. We are just human and forgetting things are its normal nature. Thus, looking up in any syntax time and again is not bad practice.
I mostly check the method's available parameters and repeat this several times. It may even happen 4-5 times in just a single day for just one method as well. I don't believe it's unnatural.
To this day, even after using them 100+ times in production.
I don't know what does Array.slice() and Array.splice() do and return in javascript.
Also I have bookmarked MDN.
I think your question is badly worded, and nobody noticed. If you have to look up for the syntax of javascript, you're in trouble. Because it can fit on a post-it. So you have to know it. Here is a reference: w3schools.com/js/js_syntax.asp
What syntax means is that it's HOW to write code, not WHAT to write. So globally, you have:
Now, what you mean, I think, is about the functions (some people here used the word API as well) and THAT is totally fine. We can't remember all the functions and parameters of all the languages we are using in our career.
I'll second what everyone else has said - it's not a bad thing at all. It's nice to know things off hand, and eventually you'll find yourself having to look things up less and less. Plus, libraries - and even languages to a lesser extent - are changing all the time, so it's hard to keep it all in mind.
The important thing IMO is that you at least have an idea of what you're trying to accomplish. That's the harder part most of the time. Syntax and APIs are easier to figure out with a quick search.
I wouldn't say syntax, but I do look up on APIs/libraries methods, properties, argument list all the time. Thanks to VSCode that gives me intellisense 😊
I'll focus not just on syntax (like the stuff that gives syntax errors during compiling) but also common built-in functions and constructs. (E.g. things like Java map/filter, Python3 print, Rust unwrap()).
In the beginning, either as a new programmer or when learning a new technology or language, you will look up a lot, and that's okay.
After a while (weeks or months), without a need to specifically try for it, you will remember more and more automatically, because you've looked it up repeatedly.
Being able to type at least 80% of lines without Googling does help your productivity, I feel. Not a whole lot - the concepts are harder than the syntax - but it helps.
But going for 100% is not useful, except during bad interviews. The last 5% of your lines is spent on 50% of constructs. Stuff that is rare enough that it'd take long to learn, and you don't lose much time looking it up. There's even syntax that doesn't come up at all, in many languages.
So in some key points because who doesn't like lists:
A<B> for generics, { } around blocks in many languages...).Also note that autocomplete is much faster than Googling in many cases.
*Unless you're working on something like an Oracle Certified Associate certificate, in which case, stop that and go do something useful instead.
It's absolutely normal. And pretty natural.
Sometimes, you have this song stuck in your head whose name you just can't remember! And what do you do? You go on Google and just write up some words and the song comes up, right? Now, this means that you know the song but don't remember what it was called.
Similarly, programmers usually do the same. Suppose you're using a new library; you understand how it works, what it's built on, but you forget how to do something very specific? Say, for a HTTP Framework, you forgot how to send HTTP Headers specifying CORS. I'd bring up the library documentation and see what all is mentioned; it usually takes me one or two tries before it's imprinted in my head.
This is usually a very, very good practice. Always consult the documentation before posting a question.
And this does not, in any way, make you a bad programmer.
However, if you are looking up something very basic things (like what does === vs. == mean; or what does the typeof operator do) and that too, very often, that is a bad practice. But, if you are searching when to use === vs. ==, that is something good.
In it's simplicity, you can break up searching online into two broad categories:
And both of them are fine.
If you see yourself consulting the web too much for something basic, you might need a fresher perspective on the topic! And this, again, is very good! It really extends the amount you know about something.
If you put this as a poll it would be 100% look stuff up.
Clayton Ray
Software Engineer
Depends how familiar I am with what I'm doing. For something like a simple React component, I don't need to look up syntax. I've done it a million times so that's committed to memory. But, let's say, Rust... I'm just really starting out with it and have to go to the docs to see how to do even simple things. I'd also add, sometimes my brain just refuses to work with me.
Example:
I was super tired and trying to filter an array. I tried doing
.filter({ name: -1 });instead of:
It really just depends. But it's super normal. (Though, I don't know how you define "experienced programmer" so my opinions may not be applicable)