top of page
Search
Writer's picturetechwriting

Most Common Programming Mistakes

Programming is all about working smart and finding effective ways to build useful software. Whether you are 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 some very common mistakes to avoid and make your life much easier during your coding...

1. Repetitive Code

Don’t repeat yourself is one of the basic principles of programming that you will come across as you learn. Code that is written using this principle is called DRY (Don't Repeat Yourself) 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 are 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, so keep that in your mind.


If you want to learn the basics of Python programming, CLICK HERE and enjoy!

2. Bad Variable Names

Variables are essential in programming no matter which language you are programming 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 average percent of numbers to make some calculation. You write a variable to use in the program, for example float average = 1%

All we really know about this variable is that it’s a average percent of something. Average percent of what? The code will work just fine, but it’s hard to tell what is going on here. Instead, name your variables more clearly, for example float averageNumbers = 1%

3. Not Using Comments

Use comments. Comments are the documentation of your code. They are 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. 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 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.


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.

If you want to learn more about Java programming, CLICK HERE and enjoy!

5. Not Asking Questions & Planing

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, by keeping track of the important questions and answers.

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.


6. 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.

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 will be mentally refreshed, and when you return you might find a new perspective on your code.


7. 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.

24 views0 comments

Recent Posts

See All

Comments


bottom of page