Here are some most common bad programming practices that every programmer should avoid to become a better programmer.
Also Read: 5 Tips to Become a Better Programmer
1. Giving up too soon
Most of the programmers give up when they are very close to solution. So never lose hope and keep trying, you will definitely find a solution.
2. Acting defensively when someone critiques your code
Be calm when someone criticizes your code. Just listen carefully to them; maybe it will help you to improve your code quality.
3. Refusing to ask for help
Don’t be ashamed of asking help from other programmers. Don’t feel that others will think you even don’t know such a small thing. Just go ahead and ask for help. There are several programming forums like stackoverflow where many experienced programmers are active who would definitely help you.
4. Passing blame to others
A good developer is one who takes ownership and responsibility for the code he/she write.
5. Ignoring the opinions of other developers
Pair programming with other experienced developer is one of the best ways to learn and grow as a developer. You can take help of other programmers and senior developers to learn efficient ways of solving a problem that you have solved yourself.
6. Not knowing how to optimize code
Finding solution of a problem should not be your only concern. You should optimize your code in terms of time and space complexity.
7. Acting like a boss, not a leader
If you are a senior developer then you should know how to manage developers in your team. You should act like a leader who can properly lead his/her team.
8. Using the wrong tool for the job
You should be aware of which tool is best for the job. Stop making decisions based on “it’s what I know”. You need to be open to using different technologies, languages, and frameworks.
9. Refusing to research coding questions
Internet is one of the most powerful tools for programmers. You should be really smart to search solution for a problem on sites like google, stackoverflow, etc.
10. Refusing to learn from mistakes
We are humans, we make mistakes. Making mistake is not a bad thing, but refusing to learn from them is bad thing. Find the ultimate cause for the mistake and keep it in mind so that you will not repeat it in future.
11. Separating yourself from the developer community
You should be really active in developers and programmers community. This will help you to have knowledge about latest technologies and trends in the market.
12. Not giving back to the community
You should be always ready for helping other programmers. You can help others by various platforms like stackoverflow, quora, etc. or by writing articles on others or your own blog.
See how I am helping other programmers by this blog. 🙂
13. Struggling for hours to solve something, solving it, and not documenting it
You may get some strange problem whose solution is not there on internet. You spent several hours and found the solution. Now it’s your duty to share the solution on internet so that others will not struggle that much.
14. Bad naming conventions
Use meaningful name for variables, functions, classes, etc. For example, using characters like x, y, z, etc for the variable name instead of something like length, userInput.
15. Writing too many or not enough comments in code
Comments are essential notes to developers. It increases the readability of code. You should properly write comments so that it will help you as well as other programmers to understand the code in future.
If you know some other bad programming habits then please mention in comment. I will love to add them in this article.
10 thoughts on “15 Most Common Bad Programming Practices”
hi Neeraj Mishra,
i need some help. That is I am struggling to learn java script. it feels like I got the point but later its gone from my mind could please help to over come this problem.
Its natural, happens with everyone. when you learn a concept just do some questions on it. Programming is all about doing practice, so write as much code as you can.
Happy Coding!! 🙂 🙂
Very nice 🙂
A Good read indeed!
i can not doing program simply hello program i cannot do. It is very difficult to do program so tell me how i want become a best programmer,??
i want to learn programming but i am facing some difficulties because in life i start first time programming and i don’t know now about programming,so please tell me what i do to learn programming .
I want your help to write a program in android and i.e., How to play video from url(Embedded Youtube Url coming from JSON parsing) in my app?
This is really very helpful Thanks for this detailed article.
really great points indeed.
thanks a lot
yeah ,practice is the only key
everything will become simple gradually . thats my promise,
happy coding and learning .
Thanks for the list.
About commenting (point 15), I think that currently the main opinion is shifting towards “write self-explanatory code, so you don’t need to comment much”.
Self explanatory code, means:
– Use really good descriptive names for all identifiers. And yes, many names will be really long. But it’s worth the extra typing.
– Keep functions (methods) small. A function must only do one thing.
– Write functions (methods) with only a small number of parameters. (One or two is fine. Four is often too much. Six is horrible. Ten is disastrous.).
– Use either named parameters, or use extra variables (with clear names) to use as parameters. For example: AddToShoppingCart(product, true, false, 12, none) is terrible. AddToShoppingCart(product, sameDayDelivery, giftWrap, discountPercentage, bonusCard) is much more readable.
– Separate levels of abstraction. For example: create a class to manage the shopping cart and NEVER let any other code outside that class do stuff that should be done by the class.
– Refactor your code, regularly during programming and also after ‘finishing’ a programming task, aiming for better readability & understandability. The task is only finished when your code is clean and perfectly readable.
When you do all of the above, you hardly need to add any comments.
There are some exceptions though. Good reason to add comments are for example:
– Explaining the concept or the story behind a program
– Explaining some quirks that cannot be explained by the code itself. Like “this device can time-out too soon, despite what it’s documentation says. For that reason, we created an extra function that ….”
The above advice was partly mine, but mostly inspired by the book ‘Clean Code’ by Cecil Martin.
And remember: programmers spend much more time reading code (their own, or others’ code) than actually typing code.
And one more piece of wisdom, by Brian Kernighan who famously wrote: “Everyone knows that debugging is twice as hard as writing a program in the first place. … Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”