Be a Good Programmer

A programmer is an individual that writes/creates computer software or applications by giving the computer specific programming instructions. ~ Techopedia

If you can write code, you are a programmer. Everyone can be a programmer, but not everyone can be a “good” programmer. This post will talk the simple things you can do to be one of the “good” programmers. Perhaps, even better! This would be a reminder note. For me, for you or for future so-called programmer.

1. Knowledge and practice

First thing first, it is all about the knowledge. Nothing can beat the knowledge. But the knowlege itself is pointless if you don’t apply that knowledge. To gain the knowledge, you need to stay curious, to learn and explore the programming and their best practices. Find your interest and start writing the code. Understand the real-world problems around you and try to solve one by coding in your favourite programming languages. Know your tools and keep yourself updated with the technology changes. Don’t forget, quick way to master is by learning more from others code. This is how you grow as a programmer. There’s never be the end to learn, the world always has something new for you.

2. Write clean and beautiful code

Everyone can write working code, but not everyone can write clean code. When you write code to make a good living, chasing your passion or contributing to the community, just be the good programmer and write a clean code. This is how you will others too. People can learn easily on what you have done or help to fix and improve for the better. Don’t be so complex, just write simple, understandable but logical code.

Here are some of the common good practices in programming:

  • Be consistent with the naming convention. Readable, easy to understand and not too long.
  • Avoid writing complex code. Simplify it by refactoring the code. Remember the single responsibility principle from SOLID.
  • Add necessary note (comment) into the code, tell what it does and why it was there.
  • There are some good design patterns in programming, use it whenever it is applicable. Design patterns provide good separation and better maintainability.
  • Ensure the critical code is testable. Write a unit test for it.

Remember this excellent quote:

Good code is its own best documentation. As you’re about to add a comment, ask yourself, “How can I improve the code so that this comment isn’t needed?” ~ Steve McConnell

3. Analyze and review

If you’re dealing with a problem, think hard before you write code. Take some time to analyze the intention you want to achive. Sometimes the solution could be more simpler than you expected, or you may need less time to fix the problem. Understand the problem closer would help you get better picture when you’re designing a solution for it.

Code review and feedbacks will help you grow better in becoming the “good” programmer. There are many things you can learn from the positive feedbacks, especially when it comes from someone who is more experienced and expert than you. Code review also can be done by yourself. Take some time to review your code, measure it and optimize it whenever it’s necessary so the code can work at the best performance.

When writing the code, I have been applying this simple concept which the priority is sorted in the following order:

  1. Workable - I have to ensure my code work in the way I expected it should be.
  2. Correctness - I have to ensure my code work in correct manner as defined in the requirements.
  3. Simplicity - I have to ensure my code is simple and short (KISS concept).
  4. Optimization - I have to ensure my code is optimized well, close-to-bug-free and compute at best performance.

4. Contributing back to the community

This is optional, but a good programmer will simply contribute back to the community. Once you’re good at something or able to produce something that has good value, you can help others problem by giving them something. It could be in the form of source code, portion of code, a complete application or a technical solution. In software community, this is how open source community works. Another way is you can become part of the project contributors that help to implement a feature or fix a bug. This is how you will help others and make the community a good place to grow yourself as a “good” programmer. Let me give you one great example: be like Linus Torvards who is the creator of Linux, used by billions of devices around the world and it’s free for everyone.