Why Is It So Easy to Become a Bad Coder?

I was once a really bad coder and at that moment…

Image for post
Image for post

I was once a really bad coder and at that moment, I had no idea what I was actually doing — that I was writing bad code. Well, trust me, I have been through all these.

I remember a few years ago Bill Gates shared this

and also Steve Jobs once said

People have been talking about coding, writing programs or websites all the time. Coding Bootcamps and online coding platforms are everywhere. Unlike twenty years ago, everyone can easily learn how to code a “Hello World” program in less than 5 minutes in almost any language.

Many people like to claim that they can code in a language after running their first “Hello World” program. However, there are much more people should learn, before they start claiming they know how to code.

Let’s look at the following example:

// Version 1
String[] names = {“Jason”, “Jimmy”, “Jack”, “James”};
for (int i=0; i<4; i++} {
println("Hello" + names[i]);
// Version 2
String[] names = {“Jason”, “Jimmy”, “Jack”, “James”};
for (String name : names) {
println("Hello" + name);

Can you guys see the difference between these two versions? Although both yield the same results, version 2 is definitely doing a better job.


In version 1, every time we add a new element (name) into the array, we have to change the i used in the for-loop. But in version 2, no matter how we modify the elements in the array, the print function doesn’t have to be changed.

An even worse example, I actually did something like this when I was first introduced to coding many years ago:

// Version 3

See? It is just too easy to write bad code. And interestingly, most of the time, bad code can always function. They are however ugly and could be inefficient and unreadable.

Image for post
Image for post

Some people might now ask, so how do I know I’m writing bad code? The fact is that — you do not know. You probably won’t know that your code is terrible until someone tells you.

Code can be clean and elegant, easily readable and scalable. Just like the examples we have above, version 2 > version 1 > version 3. Writing code is easy, but writing elegant code is not.

Writing elegant and clean code is time-consuming but we should always try to do that — Why? Because we want our code to be easily understandable by others. We want others to say “Wow, I like how you write your code! I never knew code can be written in such an elegant way!”

Here are some of my bits of advice to everyone:

  1. READ. There are many books that teach you how to write better code, for instance — Clean Code, The Pragmatic Programmer, Code Complete etc.
  2. READ MORE. Learn what Big O notation is and how design patterns can help us in writing code that is scalable
  3. Code reviews. Ask people around you (Of course to those who know how to code) to try reading your code and discuss with them if there is a better way of writing the code

I’m not saying that whoever wants to code have to follow what I say, but If you ever want to call yourself a programmer or land a job as a software developer,


Written by

Tech Enthusiast | Data Scientist | Software Developer | UX Designer

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