Blog Post

We all have heard the quote "A journey of a thousand miles begins with a single step." and it's true for coding as well. At the start, we feel very tense, lack confidence, feel puzzled and take a lot of time even for small tasks. In my own journey as well I have made many mistakes which I would like to share with you below.

1. Clarify & Design before you code: A lot of programmers just quickly start with the tasks even without first understanding the requirements and thinking about an optimal solution. This can lead to a lot of waste of time and re-work.
Beginners think coding only happens while we code and we can code on the fly. But that rarely produces optimum results. A better way is to first understand the requirements and list down / design your solution and then move towards implementation. After writing the steps you can get it re-clarified with the task-giver as well to validate if you are on the right track rather than letting the person know after a few days and then reworking.
2. Have a deep understanding of the Fundamentals: When we start coding a lot of time we are unsure how to solve a certain problem so we google it or search for it on StackOverflow. We blindly copy/paste the solution and our code start working but we don't invest time in understanding how the code is actually working. This approach is called the "End-means" approach where our main goal is to make the application work. Though this approach isn't totally wrong, this leads to a weak understanding of the concepts. And we can be heavily penalized for it in the future as some hard-to-solve bug can creep up in our code.
So invest extra time in understanding the fundamentals. You can read books, and documentation, or watch videos that talk about the basics.

3. Think about all the possible scenarios: This tip is to think of all possible cases that can happen when the application is used. Most of the time we "assume" that only a happy scenario will happen but when we move our code into production our code breaks sooner than expected. The possible answer is that beginner coders don't anticipate different scenarios that can happen. Like, suppose you are building a checkout flow with a payment step. You have to think about the payment being failed, or pending case in addition to the success case as well.
Coding is a thinking job and that has to happen before you start coding.

4. Use optimization tools: There are many tools that guide us if the code we have written is optimized or not. If there are any glaring mistakes and inefficiencies in it you will get to know. Tools like google page speed, linting packages, Django debug toolbar(in case you use Django), code profilers, etc can help you guide where you are lacking. The job of a programmer is not only to write correct, working code but to write the optimized code which gives the best performance.

5. Keep it short & simple (KISS): Sometimes beginner programmers complicate code to show they can write complicated code but this is of not much use. The code which is precise(no code is the best code), and easy to understand for yourself and others is what is more important. We have to appreciate that when we are coding we are not coding for then and there but are coding for a maintainability perspective as well. In the future when you have to debug or extend the code you should understand it quickly.

Try to break the big functions into smaller functions, use smaller files, write comments, and use descriptive variables and function names. Try to write code that anyone can understand. Look at the code of some open source projects you will understand the simplicity I'm talking about.

So yeah, we have to keep these things in mind and put them to practice every day. Getting your code reviewed by an experienced developer is also another way to improve. Just remember to be more conscious of each line of code you write and you will produce quality work. Good luck.


Learn21 conducts an online Boot Camp for web development. If interested you can check the details here.