Top 5 Most Common Programming Mistakes

By -

Doing mistakes is everyone’s right. We learn only when we do some mistake. But the point is, we have to identify our mistake, learn from it  and not repeat the same mistake again. Here I have listed some of the most commonly done mistakes in programming regardless which programming language you use or which design you use.

Here are the top most common coding mistakes. Sorted descending on level of vulnerability.

5. Using = instead of == :

Many languages uses single equals symbol for assigning values to a variable and double equals for testing equality. But most people including experienced programmers use single equals in place of double equals. This may be a minor mistake if you observe properly.

4. Handling all exceptions by only one common exception handler clause:

Java, PHP and many Object Oriented Programming languages support Exception handling. But if you handle all exceptions with a single exception handler, you may not know what exception has been raised exactly.

3. Not Validating for all Possibilities :

As an efficient-programmer, you should be very careful while you deal with inputs to an application. Validate at both client side as well as server side. Most people program only for client side validations. What if an attacker disables his browser javascript?! Your application breaks. Validating all possible inputs is the solution. A programmer should assume the end user as a mad and program accordingly. Also escape and un-escape data in a proper way.

 

2. Hard-coding everything and everywhere :

Imagine an Online Complaints Registration page and that data should be sent to the customer support team. Giving  the customer care email id directly in a function like – sendMail() feels great. But what if there is more than one place, where you are required to send an email to the same customer email id? Also, what if the customer email id changes?

When you desperately want to hardcode something, put it in a common place so that you can come back later, make changes in a file and that will reflect everywhere. If you minimize hard coding, both development and maintenance becomes easy.

1. Exposing secure information :

Consider a situation where you may need to establish a database connection, in that case, Do Not Hardcode Username and Password directly while connecting. Also make sure that, you don’t declare it in the same file as a global or local constant. The reason behind this is, you may need to get your code reviewed by another person or someone may be seeing your file knowingly or unknowingly. He could do anything with your or your team’s login details. So keep it in an external file and include that wherever you need the login credentials.

If you find this article useful, share it on social sites. It may help your pals too..

Pavan

Believes strongly in "Love what you do and Do ONLY what you love" :). Simple & Straight. Will bend whenever required. Thinks everything in technology, with technology and in most cases only Technology.. :p Laziest guy, one could ever find. If he is not sitting in front of his computer, then he must be riding on his bike, of course, not both at the same time. :p Know more about Pavan

3 Comments to Top 5 Most Common Programming Mistakes

  1. I do not feel these silly errors are brain storming to the developer normally any programmer could easily know while programming.

    Not a great thing.

    • Thanks for writing Praveen. Where I said these are brain storming to devs?. They are silly errors only. Pls read the title- Most Common Mistakes. Hope, these are most silly, common mistakes a developer can do.

Leave a Reply to Pavan Cancel reply

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

47 − = 39

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>