Errors to avoid as a programmer

Errors to avoid as a programmer

Introduction

Nobody is above mistakes and when you are to write over a hundred lines of code there’s bound to be one or two errors. In this article, I will discuss the common errors made by programmers.

There are several mistakes programmers make unknowingly in the process of learning or carrying out projects and some of these mistakes are:

Learning too many languages at a time

Learning too many languages, frameworks, or technologies all at once is not wise but foolish because you have to be good at one before going to another, don't be a Jack of all trades and master of none, for example, learning node for 2 weeks and starting ruby because you think node is better off that is foolishness. If you learn too many languages at the same time you will overwork your brain and consider the time spent a waste because you will not be good in any of the languages.

brain.gif

Self-doubt and fear

Programming might be annoying sometimes because you have to deal with bugs in your code some days and other days nothing seems to work right. Days when you feel your not good enough for this just tell yourself that you can do it, always have confidence and be positive at all times. If your code is pissing you off take a break and do what makes you happy.

happy.gif

Wrong documentation

I got used to naming my files anything I want and I always forgot to put them into folders. I just realized that my work looks confusing and scattered because of the wrong documentation.

vscode.jpg

Image source

So I can now name my files right and I put the required files in folders this gives me a more organized document.

Improper indentation

This is the Improper alignment of tags and functions in your code. Using the wrong indentation in my code made it look dirty and confusing.

inde.jpg

Image source

I recently started using the right indentation which makes the code clean.

write inde.png

Image source

Avoid coding on a line

I have been doing this for a while now and it makes the code look dirty and confusing. I actually used it to shorten my code but I have realized it is bad practice. I just realized that breaking the code helps you understand it better

Over commenting and Not commenting at all

Not commenting

Adding comments in your code is really helpful it helps you remember what you left. But most developers prefer not using comments and get confused with their code.

Highlight_NoComment.png

Image source

Over commenting

Using comments is really nice but when it is abused it makes your code look dirty.

over commenting.png

Image source

Bad variable and function names

The name you use as variable or function names is one that you can remember the spelling don't just use a long name like(IntrestRateForDiv) because you might forget it. The name is to be short and simple like( IntrestRate). For better understanding check

WET code

You might be asking what I mean by wet code. WET is an abbreviation for Write Everything Twice. This makes the code longer every time you repeat something and it is not advisable.

dry.jpg

Image source

Using a DRY(Don't Repeat Yourself) code is pretty nice because it makes the code short and nicely written.

Writing code without a plan

Imagine going to school without your books, would you learn anything? No same as writing code without a plan there will be no meaningful outcome of your work. You have to think, research, plan, write, validate, and modify before writing the code to avoid issues at the production level.

I know it all

As I said no one is above mistakes but when you make a mistake and your corrected don't brag or argue about it just accept that you were wrong and correct your mistakes. In the programming world new languages, frameworks, and technologies are coming out as the world advances and we programmers advance as well. The browser (Google it)is to be your best friend because you refer yourself to it any time you need it.

googles.gif

No backup for work

"Your assigned a project you've been on it for the past 1 week and when you want to submit the project your system crashes before the submission."

  1. Your project is lost.

  2. If it is assigned by your boss, then you are fired!.

  3. You will cry every night and every day.

  4. Other files that aren't backed up are lost for good.

cry.gif

So it is advisable for developers to have a habit to keep backup for works. Web developers should learn to use source control like(SVN and Git)

Syntax errors

This occurs when some words uncertain commands are misspelled or when punctuation marks are missed or added at the wrong place. When this error is made the code will not run.

sytax code.png

Image source

This error cannot be avoided at all times, but when you notice that there is a syntax error you should correct it to avoid our code not functioning in an expected manner.

Logical errors

This is an error that causes a program to crash while running. This occurs when the programmer does not follow the correct sequence of instructions for a program.

For example

logical.jpg

image source

Conclusion

Everything can be fixed even common mistakes we programmers make can also be fixed. When any of the above-mentioned errors are made unknowingly we should try to correct them.