6 Common Mistake in Programming I’ve Mostly Done

Katherine Petalio-Amar
5 min readJun 14, 2021
Photo by Florian Olivo on Unsplash

Programming gives us the opportunity to build useful software, whether it is Mobile App, Website, or Software Programs the principle remains the same.

When I first started coding, I barely know the good and bad habits of coding. And to be honest, until now I’m still discovering and trying to apply the good habit to all the programs I’m creating and I will be creating in the future.

I have listed some common mistakes that I have encounter in my entire career as a programmer.

1. Not Using Comments

I think not using comments is the №1 mistake created by new programmers and some experienced programmers (including me sometimes). Using comments is very important in programming since it will tell you what your code flow or function does. It will also help other programmers to debug and understand your code.

Creating good comments on your code will save you a lot in the future, and not only that it will let you also realize what’s wrong with your code. Based on my experience I discover flaws in my code logic while I write my comment, in this case, I realize it before anyone else does.

And if you are working in a company, a tendency is high that you might turn over your work to other programmers. So let us help the future reader of your code to understand how your codes work, what does it do, and everything else that you need to mention how does it work.

So, PLEASE USE COMMENTS!

2. Repetitive Code

I firmly believed the shorter the code the better.

When I started coding way back 10 years ago I admit my codes are really really long, in a way if I would rewrite it now maybe the 10 lines of code will only be 2–3 lines. As experience taught me a lot, I started to shorten my code by identifying which codes can be reused within the project or maybe on future projects.

I’ve seen lots of codes from various programmers, most of them tend to repeat codes. Which I find it really hard to debug, especially if those repetitive code has same variables, and not using COMMENTS!. It is really time-consuming.

So, next time it is better to avoid repeating your codes, try to create functions where you can call it any time you need it.

Being a programmer it is really good to build or create a code flow that can be reused.

3. Bad Variable Name

Variable Names are essentials in programming, but most of us tend to forget the good habit of naming a variable, some have been stuck with x,y, general terms, and acronyms (I still see it on some codes).

Let’s start naming variables in a descriptive way, that could easily understand.
For example :

var rate = 0.25; //Overtime Rate

Rate variable is a general term, it could be the interest rate, overtime rate, night shift rate, mid-shift rate, etc.
The better way:

var interestRate = 0.30;
var overtimeRate = 0.25;
var nightShiftRate = 0.10;
var midShiftRate = 0.10;

In this way without using a comment you can easily understand what does the variable stands for.

Other example: (Using acronyms {very bad})

var ir = 0.30; //interest rate

This is really really hard for other programmers to understand your code. Even if you used comments, the comments will only stay on the declaration of a variable, or else you want to explain each line of code using comments, on what does that variable stands for.

So, next time you’ll create a variable make it descriptive and easy to understand.

4. Not Planning in Advance

Planning is essential for every project (not only on programming even in our daily life). There is general planning for the project (Mission, Vission, Modules, etc), but aside from that every programmer must plan on how they will create the function, very basic method and most of us know about it “FLOW CHART”.

If creating a building has a blueprint in coding we have a flow chart. Creating a flow chart before coding could help you solve the problem before applying it in a code. Which is in a way it is really easier to understand a diagram than a bunch of code.

You can use https://app.diagrams.net/ if you are planning to create a flow chart for your code, it is free! Or you can just sketch it in your notebook.

If you are a programmer that also creates database tables, aside from creating flow chat you must also plan how your database structure on how would look like. This will not only help you know the fields you need but creating a good database structure has an impact on your Website or Mobile App Performance. (But having a good database structure but a long method of a query will let your website crawl {slow} in the long run. {I will make a blog on how to optimize your query and creating a good database structure soon…})

I’ve been using this https://app.dbdesigner.net/ on creating my database table structures, it has a trial version. If you know any database designers for free please let me know! Comment it below.

So, create a Flow Chart and create your database structure as well.

5. Creating Complicated Code

When we say complicated codes, n-o-t e-a-s-y t-o u-n-d-e-r-s-t-a-n-d. Complicated codes could exhibit bad variable names, repetitive code, and aside from that a really complicated logic and use of multiple loops that does not make any sense.

Please keep in mind the shorter the code the better!

6. Not Asking Question

Programming is not an easy job, it takes time and effort to fully furnish your knowledge. All things you need to know are on the internet if you can’t find it there ask someone they might know the answer to your question or problem.

Don’t hesitate to ask, but make sure you do your proper research before asking. Not all person will directly answer your question, some does not spoon feed the answer to you, they’ll just give idea on how you’ll do it.

If you do not know someone personally that you could ask a question, you could post your question on https://stackoverflow.com/ some might have a solution to your problem. There are also lots of groups on Facebook that you could join and ask questions, though to warn you there are programmers who are rude on answering simple questions since they know the answer. But do not take it to heart as long as you learn something from them that’s good, don’t mind their attitude.

AVOID THOSE THINGS ABOVE!!!

I’m also trying to avoid it as much as possible, especially the #1. Another thing, do not rush in coding, yes maybe we have deadlines to meet, but avoiding things above will lessen the issues that the TESTER or USER might encounter. Creating a good code will save you from trouble.

Good Luck! Happy Coding! 🙂

--

--

Katherine Petalio-Amar

I'm a Software Developer with experience in Web Development and Mobile App Development and a bit knowledgeable in Server Management.