Why properly naming is so important ?

 

When I started programming in 2013 I didn’t pay attention on naming variables because I started with Small Basic and nobody told me why properly naming variables is so important.

 

Fortunately, I have broken this bad habit quickly. Why ? Firstly, let’s see an example in reality. Why people say ‘a car’ instead ‘a desk’, ‘a ball’ for the same stuff ? Because when Karl Benz has invented, people called this invention ‘a car’ and currently everyone know what it is. So, when someone say: ‘Go to the car’ a recipient will go to a vehicle and sit there instead go to friend’s home or start playing a game. It is a clear communique and everyone would know what to do. Everything on this world we named.
During coding, make names of variables, functions in clear, understandable and short way. I tried to show you this in my first project in Visual Studio. In case of loops it doesn’t matter because name of variable you can use only there and only there (in a loop). But  global and local (beyond loops) variables are going to use more than once. Instead of thinking what it could be mean, during creating a variable and giving her clear, understandable and short name, you will always know where use specific variable.
Obviously, you can say: ‘You are wrong’. I agree with you in 5% – really. Let’s see why:

 

Do you see a difference ? Which versions of code could you understand faster ? I suppose that both version aren’t difficult to understand – this my 5 %. Assuredly, you are going to ask, where are remaining 95 % ? Let’s see if you will be able to understand little developed version:

Are you able to understand what coder had on his mind ?

Let’s see the corrected version:

Did you understand more information ? I think-yes. When I started my journey with programming I was coding in wrong way – not clear, understandable names, so when I had to explain someone my code, I couldn’t do that because suddenly I didn’t know what is wrote there. I changed this and when comes a situation when I share my code someone, usually I don’t have to explain because naming of everything is understandable. What would you do when someone could give you this type of code (not clear). Assuredly you could be unhappy, demotivate to further developing a project. So I hope that I convinced you to naming everything, especially variables in good way.
Remember !
Clear, understandable, short naming in programming = happy   🙂

More about giving a name

 

Leave a comment