Mistakes we make while writing code as a noob programmer!
August 5, 2019 - 4:00 pm

Mistakes we make while writing code as a noob programmer!

This blog is not intended to make you feel bad about your coding skills. Let’s be honest we make mistakes and that’s the point we can learn from. Been in the IT industry for almost a year, I do make a lot of mistakes every day, but looking back at a time that rate changed from hundreds to ten or fifteen. Make mistakes, learn from it & don’t be ashamed of that. Today I’m going to point out some mistakes I did as a programmer and how I learned from it. The list is just in random order.

1. Plan before you start to write code

When we are assigned to write a code for a specific functionality without adequately understanding the problem statement or without any planning, we jump off and start writing codes. It needs planning & research. Think of writing code as art. You can’t jump off and start drawing you’ll have to plan what you want to draw, how you are going to draw, what are the things you are going to need to draw that. Same goes for writing codes also. You need to plan how you are going to solve the problem, research how to make it better, data you are going to need to complete the functionality. If you are working with a team, discuss with other members, plan your goal, draw diagrams, take notes, to make everything clear in your mind or if you are working alone, give yourself some time to think of possible solutions and choose the best from them and then start writing.

One of the great mistakes was to jump in and start coding without thinking of the impacts or anything. It might work for small projects but not for big ones and once done check and recheck every line of code. Make it even better.

2. Improving code quality

Like I told already think of writing code as art. Your art should be beautiful, right? So why your code shouldn’t be? We often make the mistake of not following some standard protocols to make codes readable.

Choose variable names wisely. Your variable name should describe what kind of data it’s holding. For instance, I am fetching some students data from the database of a particular school using Laravel.


i) $a = Student::where('school_name', 'LIKE', 'ABC')

->get();

ii) $students = Student::where('school_name', 'LIKE', 'ABC')->get();

Which variable name suits better for the data you are fetching? It’s $students, right? Same goes for function names, classes names and other files name.

Write documentation before each function. What parameter it receives, what the function does, what it returns, comment in some lines if needed. So that whenever another person reads the code, it’s readable for him. If your code is not readable, it’s complete trash.

Avoid duplicating codes. If you need specific functionality in different places, you shouldn’t write that code in different files every time. Just write it in some other file. And, call the function from where you need.

Follow MVC rules. Write the different type of codes in different files. Make separate folders for separate fill types.

Use spaces, comma, new line where necessary.

3. Coding alone while watching tutorials & reading documentation of a programming language

Another mistake we always do is not to follow along and write code while watching tutorials. It’s a good practice to watch and write code that helps you to understand better. That’s an excellent chance to practice what you are trying to learn.

Reading the documentation of a programming language is a must. Most of the time, we only focus on just watching tutorials. But, it’s always better to read the official documentation of the programming language you are trying to learn. It gives you the inside of that language also a better understanding of every features that language provides.

4. Performance improvement

Most of the time, we focus just on the functionality without giving much thought about its performance, user input validation, security vulnerabilities We have the habit of assuming everything works. Every line of code should be bulletproof, that means 100% performance in any possible scenario.

  • Reduce database query if possible.
  • Check every possible input that can come from user and validate
  • if your code hurts other functionalities,in that case Check & recheck.
  • Have a clear understanding of data changes and possible outcome after the function executes.
  • Your code shouldn’t bring any security threats to the system.
  • Try to reduce the number of iterations.
  • find out what Exception the function might through and correctly handle that Exception.
  • Try to understand other peoples code & question those if those are not well documented or readable.
  • Find bugs and solve them. “Ignorance is bliss” but not in this case.
  • Learn to use debugging tools.

5. Admit that you don’t know everything

We are human beings. It is a fact that we are not perfect & we don’t know everything. You always have something to learn. But, when you start to think that you know everything that will be your greatest mistake of all time because, when you lose the interest to learn anything new, and if you are not learning anything new, you won’t survive in this ever-growing IT industry. If someone finds out mistakes in you, appreciate them. Appreciate code reviewers. Take their suggestion into accounts.

6. Learn to ask for help & learn to google

It’s always good to ask for help if you are stuck somewhere for a long time. Talk with experts & discuss your issue, they might guide you for a solution Learn to search in google. There’s 99% possibility that the problem you stuck on right now someone else must have faced that too. They may have asked it on forums, and some others may have given some outstanding solutions. Learn to R&D, and the best way doing that is to Google it and find out the solution, you are looking for.

7. Stop being scared & doubting yourself

The number one mistake you can make as a beginner programmer is to think you’re not good enough, not smart enough and you’ll never get it. I believe that anyone can learn to program to at least a basic level if they stick with it.

Code may seem like an incomprehensible wall of alien language at first. That’s normal! But, bit-by-bit you learn what each part does, and it’s not scary anymore, and then you see it’s really all very logical when you know what it means.There’s an element of natural talent for programming and logical thinking, but it’s massively outweighed by hard work and hours spent plugging away at your code, reading tutorials and looking-up documentation.

Master your fear, or fear will be your master!

That’s all that came out of my head while writing this blog. Surely I’ll make many mistakes & learn from those in the future. And I will share those too. Till then keep on coding, make mistakes, learn from them, start improving your codes.

Share this post

6 comments

  • author image
    Reply

    Md Rabby Hasan

    Very Helpful Article. Carry On ❤❤

    • author image
      Reply

      Kamrul Islam Tushar

      Thanks man

  • author image
    Reply

    Abdullah Al Jobaer

    It was really a helpful one. Thanks for sharing.

    • author image
      Reply

      Kamrul Islam Tushar

      Thanks

  • author image
    Reply

    Khalid Rafsan

    Wonderful piece of writing. Please continue to write more on the relevant context.

    “Master your fear, or fear will be your master!” – Thanks once again for the shoutout!

    • author image
      Reply

      Kamrul Islam Tushar

      Glad that you liked it. Of course I will share my experiences as I go through.

Leave a Reply

Your email address will not be published.