Hexlet's blog

Write your story
How to Read Professional Literature More Effectively main picture
Code

Reading is important. However, the process of reading matters just as much. On the one hand, one doesn't want to miss useful information, on the other, trying to understand and comprehend every word stretches this process to infinity. Next, I will share my way of reading. Most likely, it’s not for everyone, but, as a practice has shown, many people like it.

Code Complete: Naming Mistakes to Avoid in Programming I main picture
Code

Below are the most common mistakes programmers make when naming variables and functions in their code. These examples are taken from the projects of Hexlet students. I use JavaScript for demonstration purposes only because it is the most universal language, so the examples have nothing to do with the language being used. These mistakes are found everywhere in equal proportions.

Code Complete: Naming in Programming main picture
Code

What is the most difficult part of being a programmer? Naming variables.

This joke seems to be popular for a reason among programmers. Naming often causes a lot of struggle. And indeed, how we name our entities (functions/variables/constants/classes/modules) is of great significance, because most of the time we read code, not write.

Code

It is very easy to make mistakes when you have to handle variables, change them, keep track, etc. Especially in a loop. A great way to understand what's going on is to use the simplest debugging technique — console.log. This function prints onto the screen whatever you pass to it.

I have a function that iteratively calculates the factorial. The idea is simple: multiply numbers from 1 up to n.

User avatar R. D.
R. D.
19 January 2017
Suggested learning programs

From zero to a developer. Refunds in case you won't get a job

Frontend Developer icon
Profession
New
Development of front-end components for web applications
start anytime 10 months