10 Most Common Programming and Coding Mistakes

Anthony Grant Updated 05-12-2019

Programming is all about working smart and finding effective ways to build useful software. Whether you’re creating software programs, web apps or mobile apps the principles of programming remain the same.


When first learning to code it’s important to understand good habits and bad habits. Knowing mistakes coders make, and how to avoid them, can help you build a better foundation in your programming. Here are 10 very common mistakes to avoid.

1. Repetitive Code

Don’t Repeat Yourself is one of the basic principles of programming 10 Basic Programming Principles Every Programmer Must Follow Always write code that can be maintained by anyone who may end up working on your software. To that end, here are several programming principles to help you clean up your act. Read More that you will come across as you learn. This is often shortened to DRY, and code that is written using this principle is called DRY code.

Repeating code is an easy trap to fall into, and often takes some review to understand just how much code is repeated. As a good rule of thumb, if you’re copying and pasting code it’s probably repetitive and should be changed.

Get comfortable using loops and functions to do your work for you and this problem will go away. A web framework can also help you cut down on repetitive code. Here are a few web frameworks worth learning as a developer 5 Web Frameworks Worth Learning for Developers Interested in learning advanced web development? Avoid writing repetitive code---use these web development frameworks instead. Read More .

2. Bad Variable Names

Variables are essential in programming no matter which language you’re working in. Because they are so widely used, it’s important to have good habits naming variables.


Variables should be named accurately and neatly. Avoid using general terms that don’t mean anything. It’s quick and easy to throw something together, but when you need to come back to your code later it makes it much more difficult to figure out what is going on.

Let’s say you’re writing a program that uses an interest rate to make a calculation. You write a variable to use in the program.

 let rate = 0.1;

All we really know about this variable is that it’s a rate. What kind of rate?

The code will work just fine, but it’s hard to tell what is going on here.


Instead, name your variables more clearly.

 let interestRate = 0.1;

3. Not Using Comments

Use comments! Comments are the documentation of your code. They’re the best way to describe what exactly is happening in your code as it grows. Sure, it seems a little bit more work to explain your code but you will be thanking yourself later.

Write a brilliant function? Write a comment about what it does. Creating a new object template for Object-Oriented Programming? Break it down with a comment. Comments are used in every language, and they are there for a reason.

Comments make your code cleaner, easier to navigate and make you the hero to the next developer that may need to work on your project.


4. Language Overload

A problem that seems to overload growing developers is the barrage of new languages and technologies. Online developer communities are full of questions about language choices.

Should I write in my app in JavaScript, or should I use a framework like Node.JS or Express? Should I use Python, Scala, or Ruby for development? C or C++ or C#? Which framework is best? Should I learn MongoDB or SQL or SQLite for a database? Is this language outdated??

Don’t worry about that.

Step back, focus on the basics. Languages come and go, but the most successful developers are problem solvers. Build your programming on algorithmic thinking and everything else will fall into place.


These technologies are just tools and if you know what the problems are, you will know which tool to use to solve them.

5. Not Backing Up Code

Not building the right habits to protect your code is frustrating to new developers, and disastrous to experienced ones.

As a programmer, it is so important to save and backup your work constantly. It’s no different than working on an important document or spreadsheet, which is saved frequently.

Learn how to manage your files with Git Manage Your File Versioning Like a Programmer With Git Programmers created version control systems (VCS) to solve file version control problems. Let’s look at the basics of version control using the top system today, Git. Read More . Any version control really, the software you use does not matter as much as knowing how to use it well. You don’t want to lose an important change if your computer crashes or a network fails.

6. Complicated Code

Coding is not an IQ test. It’s not a challenge to see who can use the most intricate functions or impressive looking files. The code should be written in the spirit of solving problems efficiently. Simple code is easier to write, easier to maintain, and easier to manage.

To be clear, simple code does not mean taking shortcuts. Simple code means getting down to the heart of the problem you want to solve, and solving it effectively. And pseudocode can help you with that. Here’s what pseudocode is and how it can make you a better coder What is Pseudocode and How Does it Make You a Better Developer? Struggling to learn programming? Get to grips with code by learning pseudocode. But what is pseudocode and can it really help? Read More .

7. Not Asking Questions

Programming is hard to do well, and getting better means learning new things constantly. The best thing you can do is read and study programming to get better, but when you need some additional guidance do not be afraid to ask questions.

Asking questions can be intimidating, but most veteran programmers are glad to share knowledge and ideas.

Just make sure you’ve done your research and have given it a real effort. Experienced developers are more likely to mentor you if they see you’re dedicated to learning. Maybe keep a programming journal to get better Become a Better Coder by Keeping a Programming Journal Keep a programming journal and tap into some obvious benefits. Writing a journal can help you work through your thoughts and keep track of your programming goals. Read More , by keeping track of the important questions and answers.

8. Not Planning in Advance

Writing effective software starts with good planning and design. If you wanted to build a house you would draw up a blueprint before building. Programming is no different.

Before you even write one line of code, identify what you actually want to accomplish. Know what the problem is, how you want to solve it. If you try and figure problems out while you’re writing code, you may find yourself missing the right solutions.

Separate the problem solving from the coding and life is good.

9. Not Taking Breaks

Take a break, really! Programming is mentally taxing, and going hours on end pushing your brain to the limits will eventually wear you down. Even worse than fatigue, you could suffer headaches or neck pains which are signs of computer eye strain 5 Signs You Have Computer Eye Strain (And How to Relieve and Prevent It) Computer eye strain is a real issue for up to 90 percent of heavy computer users. Here's everything you need to know about what it is and how to prevent it. Read More .

When you hit the wall, it’s time to take a break. Get away from the screen for a little bit and do something you enjoy. Read a book, hit the outdoors, go hiking, go out for dinner, anything that gets you away.

You’ll be mentally refreshed, and when you return you might find a new perspective on your code.

10. Not Having Fun

Programming can be challenging, frustrating, and can sometimes be a downright grind. Make sure you enjoy the little things that you love about coding and don’t forget to have a little fun.

Whether you got into it to solve complex problems, build beautiful designs, or just to learn a new skill use what you love to keep you going. There’s a lot to love about coding so get inspired! Get excited to make something new, and see it through to the end.

Don’t Make These Programming Mistakes

It’s easy to get into a rut, either trying to get your head around something that should be simple, or trying to remember what some code does. Whatever the problem, avoid making all of these mistakes and you should find your code improving.

Still struggling? Don’f forget, there are plenty of hobbies for programmers that don’t involve code 10 Hobbies for Programmers That Don't Involve Code If you want to exercise your mind in a fun way without writing a single line of code, there are several no-code hobbies you can take up to become a better programmer. Read More .

Related topics: Hacking, Programming.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. JD
    December 13, 2019 at 5:35 pm

    Over the years, I have learned that the most important things to ask before writing any program are "who is my audience and what is their level of computer literacy?" There's no point in creating any kind of software that people can't or won't use. Beyond that, I agree that annotation is critical so you can remember what you did six months later....

  2. HildyJ
    December 6, 2019 at 12:29 am

    All of these are good but I would add one more: Validate Your Inputs. If you need eight characters, make sure that you get eight characters. If you are expecting a number, check to make sure a number was entered. If you are expecting an email address, make sure it's properly formated. Et cetera.

    • Anthony Grant
      December 7, 2019 at 5:30 pm

      That's a good one too, increasingly more important for form input. Knowing how to write regex to validate inputs is critical

  3. Kirby Wallace
    August 20, 2018 at 1:06 am

    I'm surprised this list doesn't include what must be almost the most common error of all, the notorious "off by one" error. But, I guess Index Validation kinda covers that topic.

  4. harkirat
    October 14, 2017 at 10:12 am

    Great article! Thanks.
    I want to ask one thing I don't know is this the right place or not but I have asked this questions to a lot of people but got a reply. I hope you can help me out and please reply even if the answer is not known. Recently, I have given a company exam, in the coding domain, some of the parts were locked and other were unlocked to write the logic.
    I wrote the statement: return arr; // this resulted in an error.
    My question is how to return an array from a function?
    Please, help.

    • Jane
      February 23, 2018 at 5:11 pm

      Return it in an object.

  5. Krutika
    October 13, 2017 at 7:19 am

    Thank you for sharing the information!

  6. German
    October 13, 2017 at 1:06 am

    "Memory allocation is very common in C and C++ since all memory management in these languages is manual. "

    This is a brute error. Please, learn before trying to teach.

    • Jay Sridhar
      October 13, 2017 at 2:29 am

      Care to explain? Which part of the statement is wrong? Are you aware that memory allocated in these languages need to be freed? Does that not make it manual, as opposed to being garbage collected like in Java?


      • mearnsgeek
        October 13, 2017 at 6:17 am

        Your statement isnt wrong but extremely simplistic and memory *management* is the real issue not the allocation of memory which happens manually in all languages - "new Thing()" in Java or C#?

        Going back to c++, memory allocated on the stack for local variables is automatically allocated and modern c++ heavily promotes the use of smart pointers making memory management exactly the same as for any other reference counted language such as python.

        I have to say that I thought your article would be based on studies with figures to cite but it looks more like a simple list of errors that can happen.

  7. Fred
    October 12, 2017 at 5:10 pm

    You dick. These are really obvious ones that you learning in basic computer class.

    • Vladhed
      February 23, 2018 at 7:49 pm

      ...and yet people continue to make them, even after years of experience.