7 tips to improve your coding skill

Posted on April 14, 2016

I have seen many experienced programmers writing clumsy code which is not readable at all. Many programmers declare irrelevant variable names. Many do not put comments in complex code and later forgets for what purpose s/he wrote those lines of code. Many get afraid when it's time to get their code reviewed by someone else. In this article I will explain tips to improve your coding skill and become a confident programmer.

#1. Read other's code

Reading someone else's code is very difficult compared to writing your own code. A good programmer is the one who can read other's code and is aware of the clean code conduct. When you read other's code, you realize the importance of writing clean code.

If you have joined an open source project you already know this. If you have not - I strongly recommend you to join one and see how your peers are writing their code.

When you interview with top firms like Google and if you mention that you have read a lot of code in some open source project and you did some modification on that, they will be very impressed.

#2. Pick a language, have your own style and stick to that

I would suggest that you pick an object oriented language (Java/C++) for your day to day coding and stick to that. Don't keep on changing your main coding language. It's fine to have a secondary language but you should completely master the nitty-gritty of your primary language.

For example - My primary language is Java. But I often spend my day coding in Python. But I am not that comfortable with Python as I am in Java.

When you write code don't keep on changing your style. Pick up a style and stick to it. For example - when I participate in a programming competition, I follow the below style.

class Solution{
public void run(){
/*All of my code starts from this run method
*In this way I don't have to deal with unnecessary errors like
*calling a non static method from a static method etc.
public static void main(String [] args){
new Solution().run();

Having your own unique style will keep you away from most of the unnecessary errors and you will be able to write your code faster.

#3. Do not reinvent the wheel

Most programmers are not aware of the built in libraries that come with the language and they end up writing their own methods. This makes their code more vulnerable and error prone. Always use the built in libraries as much as possible.

If in an interview, you do not write code using built in library, you will create a bad impression and the interviewer will think that you don't have strong hold on the language.

So, know your language. Don't try to by heart the built in methods. This will not work. You have to practice them as much as possible. At first it will be really difficult. For example - in Java there are compareTo(), compare(), hashCode(), equals(), peek(), remove() and many more...

You will have the feeling that you won't be able to master all the built in methods but hang on. Try using them one by one and without even knowing you will master them completely. If you are starting with Java try this Head First book. It's awesome.

#4. Do not get scared by other's speed

You will always meet some guys and it would seem that they are miles ahead of you but in reality they are not. They are at most one month ahead of you. And with a little bit of hard work you will catch them in no time.

Especially if you are competing in some programming competition, some guys will be solving the problems in blazing speed.

Last year in the second round of Google Code Jam one guy from USA solved the first question in 4 minutes. That means before I finished understanding the meaning of the first line of the question, he was done with coding the entire program. That was scary.

In Code-forces competitions, you will find some guys running graph algorithms like DFS and BFS on raw input.

Don't get scared by them. In most of the cases, their code are often less readable and very complex. Proceed with your own speed. Write clean, readable code which matters most.

#5. Practice some patterns and always use them

When I write code like finding permutation, combination, Depth First Search, Breadth First Search etc. I don't have to think anything. My fingers automatically goes to the appropriate keys on the keyboard.

I have practiced these codes so many times, that my brain does not have to think about them. Make a list of basic algorithms and data structure and practice them as many times as possible. Here is my list of basic data structure and algorithms.

Data Structure List

  • Hash Map

  • Binary Search Tree

  • Graph

  • List

  • Trie

  • Suffix Tree

  • Interval Tree

  • Binary Indexed Tree

  • Array

  • Heap

  • Stack

  • Queue

  • Avl Tree

  • Segment Tree

Algorithm List

  • Breadth First Search

  • Depth First Search

  • Quick sort

  • Heap sort

  • Merge sort

  • insertion sort

  • Topological sort

  • Permutation

  • Combination

These data structures and Algorithms act like building blocks for many complex algorithms in which you will be working in your career. Build your own list and practice to the point after which your brain does not have to do any thinking while implementing them.

I have implemented Generic Java Hash Map from Scratch. You can look at my code if you want.I still practice these Data Structures and Algorithms once in two weeks.

#6. Practice on Notepad

Don't use any IDE to practice. Many programmers advice to practice your code in paper/white board. However practicing them on paper/white board becomes very inconvenient in many circumstances. So, I would advice you to practice them on Notepad.

Try to avoid as many deletion/rewrite as possible while practicing your code. If it does not run or gives incorrect output, try to find the bug without using any debugging tool or PRINT statements.

Practice till you know that you don't need any more practice.

#7. Compete in Programming competition

Once you are done with practicing your basic data structures and algorithms, you will have the Adrenaline rush to use them in some real environment. This is your programming crush and follow it till you get over with it.

Compete in HackerRank, HackerEarth, CodeForces etc. and apply your newly learned data structures and algorithm to solve the tricky problems. Also try to solve the previous competition problems. But remember this is just for fun.

Don't develop addiction to it because the actual real world problem that you will face in software field will be very different and complex. Unlike your programming competition problems, you won't be able to solve them using a particular trick.

Best of luck with your programming and if you are able to find some value in it, please share it with your friends.

Leave your queries in the comment section.

Sharing is Caring!



profile image

Kaushik Baruah

Research Engineer @XRCI


My name is Kaushik Baruah and I am the chief blogger on this Blog and here I like to share my experience as software engineer and research engineer with my online readers. I will try to focus on career planning, latest emerging technologies and tutorials on various computer science subjects. You can follow me on Twitter, Facebook and Google+



Copyright © 2016
About Us

My name is Kaushik Baruah and I am the chief blogger on this Blog and here I like to share my experience as software engineer and research engineer with my online readers. I will try to focus on career planning, latest emerging technologies and tutorials on various computer science subjects.

Get Free Updates