9 Bad Coding Practices You Need to stop

You are currently viewing 9 Bad Coding Practices You Need to stop

Bad habits are hard to break and even harder if you don’t realize that what you are doing is undermining your work. But if you just don’t care about that would be the worst. So

Terminal stack is here to aware you of some of the bad coding practices. 

1. You don’t focus on one language

A good programmer should master a single language at a time. A language about which you know everything. If you are good at c++, master c++ first then go to another language. instead of learning different languages at a time, one should master one language at a time.

2. A typographical error in your code

This is one of the common mistakes and maddening because these mistakes have nothing to do with your programming skills. Even so, a misspelled variable_name or function_name can throw an error in your code. What’s more, these kinds of errors may not be easy to spot.

What’s the solution? Working in a well-integrated development environment(IDE’S) like

vs-code. Another thing you can do to reduce this kind of error is to deliberately choose variable_name or function_name which are easy to spell and, therefore easy to spot when misspelled.

3. Copying/Pasting code Blindly

Getting help from StackOverflow is OK but, you should understand the code before reusing it. Sometimes it is hard to understand what code is going to do at the first glance and you can also learn more about problems in your code when you take time to read the code in detail.

4. Failing to Format your Code

Formatting your code makes it easier to understand and spot errors present in the code. It also makes it far easier for another person to maintain your code.

If you use an IDE that doesn’t beautify/format your code, you can also use Code beautifiers like Uncrustify.


5. Refusing to ask for Help

Even if you are building a solo project you can’t expect to have a solution to every problem you might encounter  Solving the problem alone is the inefficient way and will take 10 times longer to finish and you will end up learning the same thing.

Asking for help is not weak, it’s the smart thing to do and you will learn that thing in a short span of time which will ultimately save your time.

Stack -Overflow is a site where lots of people find solutions. even Twitter is also a great place to find solutions, the community around “Tech Twitter” is very helpful

6. Using Names that don’t Add Information

Naming is hard but there’s an easy way to make sure variable/function names are at least of decent quality. As long as names add some kind of information to your code that the rest of your code doesn’t convey. Naming also makes it easier for someone else to understand your code easily. Also sometimes it takes much more time to understand what actually that piece of code does while with a good name it could be understood in seconds.

7.Avoiding Best Proven Practices

Code reviews, Test-driven development are these kinds of methods have proven their significance in countless projects. A great reference to this is the book  Making Software: What Really Works, and Why We Believe It. You can take your time to learn how to do it properly and your development process will also improve in all of the processes and this will surprise you.

8. Failing to Modularize your Code

It is good coding practice to write functions to do only one thing and only one thing which makes it easier to understand and maintain the code. Long functions have many possible paths through them which makes them difficult to test.

One easy way to modularize your code is that one function shouldn’t occupy more space than a single screen.

9. Giving up

Should you give up so quickly? Despite getting too close to a solution most of the programmers give up before they arrive at the solution. It’s true that there are some technical challenges that prevent us from developing something. However, a long process doesn’t mean that it can’t be done. Giving up is a different thing from knowing when to stop and one shouldn’t let the perception of giving up come to their mind.

If you want to share other coding habits that are harmful, leave a comment.

This Post Has 2 Comments




    USEFUL bro

Leave a Reply