Codementor Events

5 steps to become a better programmer

Published May 29, 2022
5 steps to become a better programmer

During one of my classes, one of the children I teach programming asked me how she could be a better programmer. Using my 22 years of active programming and 13 years of professional experience, I managed to answer her question the best possible way. After answering her questions, I thought of posting it since it might be beneficial to someone. I will make this brief.

Here are five things that have helped me progress in my programming journey.

DRY - Do Not Repeat Yourself

The first rule of becoming a better programmer is to recognize that you should strive to avoid repeating yourself in your code unless it's absolutely necessary.

This means that if you have a chunk of code that you realize you've used multiple times, figure out a way to put it into a class, function, or include it in some way. As a result, it will be easier for you to call for it whenever you need it.

The advantage of this classification is that it reduces the number of files you have to touch when you have a simple change to make in this chunk of code.

Avoid Nested Loops

To save you the stress of understanding The Big O Notation and how it improves your coding implementation; in plain terms, avoid multiple nested loops if you can.

You're avoiding this because it increases your code execution time. While the execution time may appear insignificant when dealing with little amounts of data, it might become a problem when dealing with large amounts of data or traffic.

As much as possible, try to separate the loop into a single loop at a time, rather than nested loops.

Allow the tools to do their job

Allow the tools to do their work while you're trying to decide whether to process records using your programming language or your database. Allow your database to join, select, filter, and process records, while your programming tool should assist you in manipulating and presenting the business logic.

Although this is debatable, I can assure you that doing so will make your life better. It cleans up your code.

Read and Try to extend other people’s code

Download or clone other programmers' projects and examine their source code to discover how they code and manage issues. Examine their code structure and pattern. Learn from their code, try to comprehend all they created, and at the very least, make efforts to extend it.

I enjoy picking up projects and extending them because it allows me to learn new code patterns and methods. Try this frequently and you will appreciate me for it.

Ask questions when you are stuck

When you're stuck, please ask questions. Either through Google or by asking my senior colleagues, I usually asked a lot of questions when I first started programming, Their approach to problem-solving influenced the way I look at and approach problems.

It's fine to attempt to work things out on your own, but if you can get help right away, please do so. You can also find a peer coding sessions with your friends. This will help you learn faster. You book a session with me for a peer coding session. I will gladly oblige you.

Ask, ask and ask.

Bonus: Comment your code

Adding comments to my code was something I learned as an undergraduate. It has undoubtedly saved me many tears and hours of debugging.

Discover and read more posts from Akinyele Olubodun
get started
post commentsBe the first to share your opinion
Show more replies