Hey, who are you? A student? Or a fresher? Or an experienced programmer? Well whoever you are, there are some things you should care of while writing any code. Let us see how to not write a program.
How should we Code!
Most of the tutorials (including python on our site) explain how to write and how syntaxes work and blah blah. But there are some points they may not tell you. So now I’ll list out the points to refer while coding.
Even if you’re an experienced programmer, there are some things that you may not be doing.
Firstly, let us discuss whether you should code or not.
If you’re a computer student then obviously you have to code. If you’re just finding TV series like Silicon Valley, Mr. Robot interesting, and you want that success in no time, then the coding is not for you.
Coding requires dedication, patience, eager to learn, passion to solve problems.
If you’re having all of these in you, you must learn to code.
Most people said everybody should learn to code, no, only those people who are having the above things in them should code. Maybe everybody should be able to understand the code.
Now, let us get to our point. How we should not!
1. Not using comments in the code.
If you’re a newbie, you may not find commenting essential. But as you would progress learning and experiencing, you would find it extremely important.
Take one general example: if some employee is quitting and another is taking is a place so the next one should be able to understand what the previous has done. That is why comments are highly important.
2. Using libraries for simple things.
Some things can be built by ourselves. It is not necessary to use the library for every work because it may make your application heavy or time-consuming.
3. Importing libraries even if not needed.
Sometimes, the user may import the entire library in the program even if just he needs the specific function. Importing specific function reduces the space and time complexity as well as it gives compiler/interpreter easy work.
4. Not Giving the proper names to the variables and functions.
Don’t declare variable names like a, b, or just like these. Declare what they really meant for. Example: insurance, interest.
5. Not Deleting the unnecessary code.
Don’t just comment out the unnecessary code. If your application is ready to go, then before the deployment, delete the unnecessary code.
6. Not Learning.
Learn, Learn, Learn.
Don’t just write the code. Learn whether there can be some parameters that can be changed to improve that.
Write once, refactor many times. Improve the code by what you have learned recently.
These are some ways to write the code. Apart from these, one way to improve your coding is by taking a break. Take some time away from your computer and relax. This will eventually be useful when you’re losing your head.
Hey Coders, Comment below if any of the points you would like to mention.