Advertisment

10 rules to become a Good Programmer

author-image
DQINDIA Online
New Update
Programmer clipart

By: Anshul Agarwal, VP - Mobile Development, Curofy

Advertisment

I wish there was a fixed set of rules to become a good programmer but alas there is none. Over the last 5 years, working in a large company and then an early stage startup, I have created this cheat sheet of 10 tips that have helped me become a better programmer / developer. If you are an expert programmer, do help me improve these points or add a few more.

1. Find a shorter way, automate using code, try to be as efficient as possible:

Make macros for repeated tasks. In real life want to watch a random movie from your hard disk, try writing a script for that; want to download a lot of files from a website, make a script for that. Take inspiration from https://github.com/NARKOZ/hacker-scripts.

2. Be curious, go deep in language:

Memory allocation / de-allocation - flow from one part to other, how stuff works under the hood. Making a REST call - know how it works, what are underlying protocols, why do we use a particular method and not other. Using thread-pool to make a thread - know how it is different from directly creating it and when will it be better to directly create it.

Advertisment

3. Read good open source codes:

By reading good open source codes, you will know the difference between ordinary and great code. You can also learn new constructs, design patterns in use etc. Do read the open source code to know how it works in and out. Using open source code should feel like time saving thing not because you cannot do it yourself. Hack into it if required.

To be a master, you need to learn from a master

4. Comments:

Your code should be commented. Period. You should be able to understand it 12 months 24 months later. Others should be able to understand it 12 months 24 months later. Most of the times others will come to you for help. It helps you to know what to except from a piece of code.

Advertisment

5. Write Reusable/modular code:

Saves time in long run. Makes debugging easier. Makes modifications easier. But don’t make it too complicated. Spend some time in thinking about code's design before starting to write it.

6. Code review:

No matter how experienced, you might overlook some things. A review helps in catching bugs early. You can learn better ways of doing things. It also helps in enforcing coding guidelines. You tend to code better if someone is watching.

7. Unit tests:

When you make change in one place, something might break in some other place. Unit tests help you to make changes confidently. They also define what a piece of code needs to do, so they are kind of a documentation. You should write unit tests before writing code. Read more about TDD (Test driven development) https://en.wikipedia.org/wiki/Test-driven_development

8. Design patterns:

Understand why, what problem, alternates, how would you solve it. A design pattern should feel like an obvious choice. Don’t make it a religion. Sometimes simple is good enough.

Advertisment

9. Read blogs:

Reading blogs of good developers will give you insights to WHY a particular design / algo was chosen over other. You will learn about real world experiences in using a particular strategy like potential mistakes, points to take care of etc. It also helps you learn from others’ mistakes and avoid them yourself. It also helps in making a design/architecture level decision.

Some blogs also helps you understand deeper concepts of a language, operating system, framework, sourcing information from several other sources or own experiences. Thus, saving your time.

10. Practice:

It’s hard to get better at anything without practice. Write a lot of code. Always try to write good code and keep improving yourself. None of the advice will help you if you are not writing code and applying good practices in realty.

Obviously I did not make this cheat sheet on Day 1. I have made my mistakes and learnt over time. But good for you, now you know what mistakes not to make. Go spend the time you save learning something new.

programmer blogs open-source-codes
Advertisment