Naming Convention in Programming | What should you name your function?

preview_player
Показать описание
Naming is everywhere in code. We use names for variables, functions, classes, packages and everywhere around the program. If we are using naming so much across the code, isn’t it important to name them right?

As a programmer, we often have to deal with the code which is written by somebody either to review it, or to debug it, to enhance the current functionality. Have you ever been in a situation where you have to make a one line change but in order to make that change, you had to go through a whole lot of struggle to understand the code around it?
I don’t know about you but I have been in such a situation.
Though such a situation can’t be completely avoided, we can definitely make it less frustrating by using a better naming convention.

When you are naming your variables, functions or classes, they should be revealing their Intention. For example, if you have a use case where you want to store numberOfSeconds in a minute in some variable, instead of naming it some random variable name, use the variable name to be something like “numberOfSecondsInMinute”. At a first look, you may not see the power of this change. But this enhances the readability of code, and reduces long term maintenance costs.

Everytime you name a variable, function or a class in your code, it should answer the big question of why the function exists, and what does the variables in it represent. I know it takes a little bit of extra effort for a good name for your variables and functions. But at the end you will thank yourself for doing that.

Subscribe to Sprint Master to get updates of our new videos

More videos:

Preparing for coding Interviews? Check out this playlist

#NamingInCoding #CodingInterviews #SprintMaster #NamingConvention
Рекомендации по теме
Комментарии
Автор

Useful. Hereafter I follow naming convention property 👍👍

boopathyn
Автор

Good info bro, very useful for beginners like me...

mast_xperiment