DEV Community

Discussion on: Tips for code newbies from an experienced programmer

Collapse
 
ghost profile image
Ghost

about 3. use some judgement, those huge variable numbers will get akward fast, just add two of them and you have a 100 chars line, very very hard to read, write expresive names but avoid 20char names also, take that function and pass to it 5 parameters and you got a paragraph of text for no reason, and in that case remove the comment, if the variable name is clear you don't need the comment. As always rules don't make up for lack of judgement is perfectly fina a 1 letter variable if the scope is a few lines and don't write Authentication if Auth is perfectly understandable. If you are new, find something interesting to make and do it, the judgement will come naturally, you'll find the right balance in variable lengths, the right thing to comment, the wrong thing to comment, etc.

Collapse
 
iraamoni profile image
Suborna

He has mentioned exactly the same about writing comment and naming variables/functions, if one is mentioned clearly other isn't necessary. But as a newbie I would possibly do both to make it more readable for me. We both totally agree, auth is ofcourse fine if later you come back and remember it but as a newbie may be I won't. Again this is for complete beginners like us. Once we are experienced and we know what we are doing, we sure can make up our minds about how we want to name things and so on. He had some advice towards me and the things I was struggling with and I just put them together in my own way for others. That's all.