Programming Habits for Good Programmers

John Au-Yeung
Apr 6, 2020 · 4 min read
Image for post
Image for post
Photo by Markus Spiske on Unsplash

To be a good programmer, we should follow some easy to adopt habits.

In this article, we’ll look at some of them and how to adopt them.

Don’t Repeat Yourself

So if we’re copying and pasting stuff and using them as is, then we should move them to a shared place so that we can use them by referencing them from that location.

It just makes our lives easier in the long run. Not to mention that we only have to test one piece of code instead of 2 of the same.

Refactor

We probably make some mistakes that violate the usual clean code principles as we were trying different things.

To make refactoring safer, we can run our automated tests to make sure that we didn’t destroy anything in the process.

Become Business-Minded

Jobs aren’t always available, so we should prepare to work for ourselves and survive or even thrive.

There’re many examples in many self-help or business books that have an example of people with a thriving business that lost their jobs or quit, and they’re happier than ever.

The moral of the story is that don’t assume that any job will last forever or will even be there tomorrow and think about the business side as well.

Also, we’ll have more empathy towards customers when we’re on the job.

Small Commits

The best time to commit code is when we get something working. This way, we know that commit has at least something working.

Also, it’s easier to find bugs from smaller commits since we can trace to where the bug was committed when we look at the commit record.

It’s hard to know what was changed from a large commit. Also, code reviews are easier with smaller commits so that the reviewers can see the progression of the code.

Keeping Our Code Consistent

They can be adjusted to the standards we want and then we can stick to them by automatically linting checks.

Naming conventions should be consistent with language specifications. For instance, JavaScript specifies that variable and functions are camelCase and constructor functions and classes are PascalCase.

No Todos

Therefore, we should just do it now or add a task to the task tracker and do it later.

Keep On Learning

Therefore, it’s an easier time to learn new things since the basic paradigms have been firmly established.

Now it’s more about incremental changes. Learning is new things that make us more useful and we help people more, which makes us valuable inside and outside of work.

New opportunities will come to us if we learn more.

Image for post
Image for post
Photo by Alvaro Reyes on Unsplash

Plan Our Code

Also, if it’s complex then we probably should ask others for their opinion in case we missed anything in our planning.

Keep Our Code Simple

Everyone loves clean and simple code that everyone understands easily.

The less code we write the better. The best is no code at all. We should just write enough to do whatever we need to do.

Conclusion

Also, no todo comments in our code. Either do it now or put the todo in a task tracker to do it later.

Small commits are also good.

Finally, we’ve to be business-minded since we’ve to be prepared to survive without a job.

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

John Au-Yeung

Written by

Web developer. Subscribe to my email list now at http://jauyeung.net/subscribe/. Email me at hohanga@gmail.com

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

John Au-Yeung

Written by

Web developer. Subscribe to my email list now at http://jauyeung.net/subscribe/. Email me at hohanga@gmail.com

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store