wrong way

How not to learn how to code

Learning how to program is a very difficult task. The journey is not made easy by the fact that it can be months to years before you have anything to show for it. Entry level programmers have so much impatience and it is the catalyst of their undoing. A good example is learning bricklaying. Each line of code is like a brick and it will be several months before you can put up a decent two room shack human beings can safely live in.

Also, fair warning, parts of this article are going to present my opinion and that opinion could cause nuclear wars. I would like to hear opposing opinions if you would take the time to comment.

Picking your first language

Here is the rather logical but incorrect way learning coders decide which language to learn first:

  1. WhatsApp was sold to Facebook for US$20 Billion,
  2. WhatsApp is an Android app,
  3. To make Android apps, I need to learn Java / Kotlin,
  4. Let me go and watch Youtube tutorials on how to make Android apps.

To compare this to our building analogy, you just went from “That double storey flat looks awesome”, to “I am going to start building my own two storey flat next week”, to “Where do I buy a trowel”. Putting it this way, you realise it makes no sense to go from not knowing anything about programming to trying to create an Android app that you can sell to a robotic billionaire.

You do not need to choose a first language to learn. This is perhaps the biggest mistake beginners make. Forget that different languages exist, it does not matter because you do not know how to code. I currently code fluently in six different languages and I do not remember learning a particular language.

Do not learn the trending thing. The current fad does not matter. Your programming knowledge is transferable from one stack to the new fad.

mr. lee

Just because Javascript currently has the highest paid developers does not mean you should learn Javascript. What will happen is you will get infected by the Shinny Things syndrome. The tech space changes so fast. I started learning Android when Java was the go to Language. In the 8 years that have passed since then, we have changed to Kotlin, got introduced to Flutter and React. You will jump from one tech stack to the other without ever truly learning anything.

Learn Java, then Kotlin, then Dart for Flutter then React with JS

The bells and whistles

Another huge mistake beginners make, trying to make GUI apps during their baby steps. This is more a basic human instinct, we need to have something to show for our work. These C++ tutorials have you printing text to a black and white console and it is boring. You want buttons, images, animations. The mistake here is you have just doubled the amount of work you need to do. On top of learning how to code, you have added the burden of trying to understand the graphical APIs that you are using, be it Android, Windows or even Web. Again, you do not go from not knowing how to hold a building trowel to erecting double storey buildings with balconies and glass roofs. Forget about GUIs when you learn how to code, stick to the console.

Do not learn languages, learn the fundamentals

Back to the discussion of learning programming languages. Let us take a look at some code examples:

//An array in C
int ages[5] = {5, 7, 42, 38, 24};

//An array in Java
int[] ages = new int[]{5, 7, 42, 38, 24};

//An array in Python
ages = [5, 7, 42, 38, 24]

The three examples above show how to declare and initialise an array in three different languages. Each language has some rule that you need to follow by altering each line of code but in essence the lines of code are similar. The point here is you need to learn programming fundamentals. Learn data types, primitives, flow control. These basics can be applied from language to language with ease. Most languages share similar syntax.

I mentioned earlier that I can code comfortably in six different languages. Once you get the hang of it, you do not even think of which language you are using. You simply fire up your IDE and get to spitting code. You get in the zone.

In the zone

Pick a tutorial course that teaches the basics of programming. Your learning list should include primitives and data types, if-else statements, for and while loops, foreach, switch statements and how you can chain them together to create simple apps that manipulate said data types. This is where you need to be very careful. You are not learning actual programming, you are learning the fundamentals. You will need to be able to disconnect from what you learn here as you start to create functional apps later on. If you take a course that teaches the fundamentals of coding in Python, you will need to unlearn some of how Python does things as Python prioritises “English Readable Code”.

One Size does not fit all

As a beginner coder you have dedicated time to learning Python because you saw a lot of Python developer jobs in your area. Now that you are comfortable with Python, you want to use Python to create a website like Facebook, an app like WhatsApp and a game like BattleCall Field of Duty 16 – Zombi Apocalypse. This is not the way. Programming languages are tools. You do not use a screwdriver to hammer nails into wooden blocks and you do not use a hammer to tighten bolts. Each language has a best fit based on the way it works under the hood and also the support available for the platform you are working on. You can create an Android app using Python but you will find very little reliable documentation or community support. If you know the fundamentals of programming, you can pick up language with ease.

Choosing tutorials

There are so many tutorials available all over the place, from Pluralsight, TutorialsPoint to Youtube. It does not matter much, pick a basics tutorial and just go.

Ditching Tutorials

I personally feel that tutorials like “How to create an app like WhatsApp” are useless and should not exist. These tutorials breeze over the basics of how to put together a working sample that is useless. At the end of the course, you cannot launch that app for public use. Did the tutorial cover how to handle traffic spikes? Avoid DDOSing your servers? How to scale up as you gain more users? They never cover this stuff which is very important. Such tutorials also do not cover good programming practices and lead to beginners creating unreadable and unmaintainable code.

Do yourself a favour, stay far away from “How to create XYZ app” tutorials.

mr lee

So how do you learn how to make awesome apps then? I will give yet another analogy. When you learn how to drive a car, you simply learn how to. When you become an experienced driver, you do not think about getting into the car, starting the car, putting it in gear, checking your mirrors etc. You simply do it sort of out of instinct. When you get into the car, your mind will be calculating the best route to get to where you need to go to with no thought on the actual driving process.

Similarly, when you have learned programming fundamentals, you look at a problem and break it down into simpler tasks that you need to accomplish. You will then stitch together each step intricately to create the final solution. You then need to find the right code samples demonstrating how to use an API and read documentation for each tool, API and SDK that you need to use. As you become more experienced, it becomes easier to figure stuff out and solve problems faster.

Programming involves a lot of reading. I mean a lot. You read documentation, go through code samples and hunt down answers to specific problems all over the internet.

And with that, I feel I have armed you with the right mindset of how to learn to code. If you need help, reach out to me on Twitter.

Leave a Comment