Hello Everyone!
When it comes to coding, most people think it is something mystical that only geeks can understand. Believe me, it is not like that my friend. Anyone can code with a fair amount of practice.
There is nothing mystical about it.
Coding is a skill like any other. Like language learning, there’s grammar and vocabulary to acquire. Like math, there are processes to work through specific types of problems. Like all kinds of craftsmanship and art-making, there are techniques and tools and best practices that people have developed over time, specialized to different tasks, that you’re free to use or modify or discard.
Here we are about to see a few bad coding habits that you must avoid.
Avoid these bad coding practices:
1. Saying “I’ll fix it later”.
The habit of postponing code fixes is not merely a problem of priorities. Organizing your issue tracker might generate some progress, but you also need to have a way of tracking smaller issues that come up. Adding “TODO” comments is a quick way of making sure you don’t miss anything.
2. Insisting on a one-liner solution
Being obsessive about writing efficient, elegant pieces of code is a common trait of programmers. It’s like solving a puzzle—you find a combination of functions and regular expressions that turn 20 code lines into 2 or 3. Unfortunately, it doesn’t always result in readable code, and that’s generally the far more important outcome. Make your code accessible first, then clever.
3. Difficulty seeing through recursion
The idea of recursion is easy enough to understand, but programmers often have problems imagining the result of a recursive operation in their minds, or how a complex result can be computed with a simple function. This makes it harder to design a recursive function because you have trouble picturing “where you are” when you come to writing the test for the base condition or the parameters for the recursive call.
4. your code is a mess
- Doesn’t follow a consistent naming convention.
- Doesn’t use indentation, or uses inconsistent indentation.
- Doesn’t make use of whitespace elsewhere, such as between methods (or expressions).
- Large chunks of code are left commented-out.
5.Reinventing the wheel all the time
Don’t write code you don’t need to. Perhaps someone else has spent a good deal of time on your problem already, and he or she might have a well-tested solution that you can reuse. Save yourself some trouble.
Leave a Reply