Why and How to learn Programming
Tags: beginners, programming, discuss, career
Published: 2022-02-28 21:27:07

---
title: Why and How to learn Programming
published: true
description: Why you should consider learning how to programm and how to get started the right way.
tags: beginners, programming, discuss, career
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j93ffb3wykwy1jtt9f3.jpg
---

This post was originally published on my [blog](https://larswaechter.dev/blog/why-and-how-to-learn-programming/).

---

Programming is one of the most demanded [skills](https://startuptalky.com/future-top-skills/) in today's world. And in future, it'll play an even bigger role since digitalization is in full swing. Software is an integral part of our lives and even children already learn how to create it at a young age. So why shouldn't you too? To outsiders, programming might look like some magic that only the smartest wizards on earth are capable of. But that's certainly not true. Learning it takes a lot of time, hard work and dedication. But in the end, everybody with the right attitude can learn it.

While learning programming, you can aim for many different skill levels. One might just want to get a brief overview, do it as a hobby or master it and find his profession in it. Nevertheless, there are many reasons why one should learn how to code and even more ways to accomplish it. In this article I'd like to show you my view of the things. **Why** you should start and **how** to go about it.

## Why

So, here are my top 3 reasons why you should learn how to code right now.

### Mind stretching

Bill Gates once said: "Learning to write programs stretches your mind, and helps you think better, creates a way of thinking about things that I think is helpful in all domains.". At least if you can trust images with wise quotes on them and call them a reliable source. Nevertheless, programming is a skill that teaches you a new way of thinking and problem solving. It improves your problem solving skills and enhances logical thinking. You learn abstraction, to focus on the important things. Even if you don't become an expert in programming, you'll profit from knowing the basics. Logical thinking and problem solving are key skills in almost every domain and required for many different kind of jobs.

Furthermore, there's also a lot of joy while writing software: solving a problem you were working on for days, fixing that nasty bug and seeing your compiler run successfully, presenting your final work to family, friends and co-workers, developing tools that make the world a better place. Simply letting the imagination run wild. And last but not least, being able to understand the memes on [r/ProgrammerHumor](https://www.reddit.com/r/ProgrammerHumor/) of course.

### Digital Transformation

How could one not be amazed by today's technology? For me, it's is as breathtaking as scary what technology is capable of and what we achieved with it in the last years. Just take a moment and think about it.

Digital transformation is changing the world dramatically fast. Almost every day your hear buzzwords like "Cloud Computing", "Artifical Intelligence", "Blockchain" or "Big Data" in the news.
There are autonomouse vehicles on the streets, some of which drive better than we humans do. Doctors diagnose diseases like cancer with the help of [Machine Learning](https://www.dkfz.de/en/datascience/machine-learning.html). Computers beat the best chess players with ease. Your Amazon, Netflix and YouTube recommendations know your preferences better than you do. Your habits are all tracked by companies like Meta (Facebook) and Alphabet (Google), whether on smartphones, wearables, voice assistants or any other technical device. You're online nearly every waking hour, feeding personal data to the algorithms of major tech companies so they can create a digital version of you. No wonder their power exceeds that of most states. It's ridiculous.

In today's world, [data is the new oil](https://www.wired.com/insights/2014/07/data-new-oil-digital-economy/), thanks to the rising number of Internet users, less expensive storage and the increasing CPU power as written in [Moore's law](https://en.wikipedia.org/wiki/Moore%27s_law). The digital transformation is inevitable and collecting data is already a given.

All this progress is primarily accomplished by software (and hardware) developed by us humans. Software / Hardware / ML engineers, data scientists, mathematicians, physicists and many more write the code that will run our future and provide the models to predict it. Having at least a small understanding of how this kind of software, models or algorithms in general work, is in my opinion one of the main reasons for learning programming. It's about building a digital awareness, knowing how your environment works and what technology is capable of nowadays.

### Job Market

Mostly caused by the digital transformation, the worldwide job market is [seeking](https://www.forbes.com/sites/forbestechcouncil/2021/09/09/rising-stars-of-the-tech-world-why-developers-are-job-market-royalty/?sh=401ef6dc8718) for talented software engineers, and companies offer great benefits to attract new employees: flexible working hours, home office, high salaries and much more. Tech jobs can be found in almost all industries like: automotive, banking, environment, fashion, health, insurance and public sector.

Furthermore, your job is safe. It's very unlikely that you'll be replaced by someone else in future, be it another employee or an AI. Coding skills are in high demand but not very common, at least not yet. There are too few of us to meet the economy's needs. That is why it's not uncommon for companies to apply to the developers these days. You have the free choice.

Altough a high salary shouldn't be the only reasons for you to learn how to code. You wouldn't be happy. Have fun in what you do, especially in your job, because you spend most of your life doing it.

## How

Now that we have discussed the reasons for learning to code, let's have a look at how to go about it. As I said at the beginning of this post, there are many ways to learn programming: university, school, bootcamps, online courses, self-taught. They all have their pros and cons. The following way is the one I would recommend to a beginner. Here we go.

### What is programming?

First of all, take a moment and think about what programming is at its core, regardless of any programming language. What is it really about and what is a computer's purpose?

The concept of programming is largely the same for most of the languages out there, whether you're learning Python, C, Kotlin, Java or JavaScript: you write a set of instructions (code) that are read and executed sequentially by your machine. You, the instructor, tell the computer what to do and how to behave. Doing so, each written line of code has a certain purpose and effect, whether you're working on web / desktop apps, microcontrollers or anything else.

The pool of instructions you can choose from and how they are written depends on your programming language. Nevertheless, the key idea remains the same.

Source code, especially algorithms, can be visually represented using flowcharts, what makes it much easier for us humans to understand them in many cases. An algorithm is just a collection of instructions with the goal of accomplishing a specific task.

Let's have an example. The following algorithm, written in JavaScript, calculates the sum of all numbers from 1 to 10, which is 55, and then prints it.

```js
let sum = 0
for (let i = 1; i <= 10; i = i + 1) {
  sum = sum + i
}
console.log(sum)
```

The according flowchart looks as follows:

![Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/apguv5fnl5jh9yi3dehe.png)

As you can see, the program can be split into smaller parts that even a non-programmer can understand. In total, there are five instructions `sum=0`, `i=1`, `sum=sum+i`, `i=i+1` and `print sum` to execute and one condition to check `i<=10`. This is obviously a fairly simple algorithm. Others can contain hundreds or even thousands of instructions, making them much more complicated.

You may have noticed that the flowchart and the algorithm it represents work independently of any programming language. You can take the chart and implement its sequence of commands in Python, C or any other language. That's the key idea that all languages have in common. Focus on getting used to this kind of workflow.

Now that you have an idea about what programming is, it's time to introduce you to Karel. He teaches you how to code by following your commands.

### Karel The Robot

Since there are so many similarities between the languages, I don't recommend you to start with one of the common ones I just mentioned above, even though this might be the conventional way to go. You'd be better off sticking with [Karel The Robot](<https://en.wikipedia.org/wiki/Karel_(programming_language)>). Karel is an educational programming language developed by the American professor [Richard E. Pattis](https://en.wikipedia.org/wiki/Richard_E._Pattis), that teaches you the core concepts of imperative programming. It does so by allowing you to write instructions to control a robot's movement on a 2-dimensional map, mostly a maze. In fact, this is what programming is all about: writing clear and precise instructions to let the computer perform a certain action.

Using Karel, you don't have to learn complicated syntax first. Its command set is manageable and very easy to understand, even for a beginner, but the functionality is still similar to those of other languages. To quote [Eric Roberts](https://cs.stanford.edu/people/eroberts/karel-the-robot-learns-java.pdf) [p. 1]:

> In sophisticated languages like Java, there are so many details that learning these
> details often becomes the focus of the course. When that happens, the much more critical
> issues of problem solving tend to get lost in the shuffle. By starting with Karel, you can
> concentrate on solving problems from the very beginning. And because Karel encourages
> imagination and creativity, you can have quite a lot of fun along the way.

Here's an example of Karel The Robot. The challenge: move forward to the right beeper (green diamond), pick it up, go back to the starting point and do the same thing for the other one. Step by step.

![Karel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sk08yk1w93wqtfzhl24j.gif)

A solution might look as follows:

```
void defuseTwoBombs()
{
    defuseBomb();
    turnRight();
    defuseBomb();
    turnAround();
}

void defuseBomb()
{
    moveForwardWhileClear();
    pickBeeper();
    turnAround();
    moveForwardWhileClear();
}

void moveForwardWhileClear() {
    while(frontIsClear()) {
        moveForward();
    }
}
```

The robot moves forward as long as its front is clear (`moveForwardWhileClear`). It picks the beeper up (`pickBeeper`), turns 180° (`turnAround`) and goes back (`moveForwardWhileClear`). These are the instructions listed inside the function `defuseBomb`. Afterwards, the robot turns 90° to the right (`turnRight`) and does the exact same thing again (`defuseBomb`). Pretty cool.

Obviously, Karel teaches you only the rudimentary basics of programming and problem solving in general. Sooner or later you have to switch to a "real" and more popular programming language.

There are multiple versions of Karel The Robot out there. I would recommend to check out the one by GitHub user [fredoverflow](https://github.com/fredoverflow/karel) which is written in Java. This one includes multiple exercises the user has to solve, like the one from above (defuseTwoBombs). Alternatively, have a look at the web version developed by Stanford Assistant Professor [Chris Piech](https://stanford.edu/~cpiech/karel/ide.html) which has some bugs unfortunately.

### Pick a language

Now it's time to learn a "real" programming language. There are dozens of articles on the Internet about whether you should start with Python, JavaScript or language xyz. Don't waste your valuable time so much when making a decision. Pick one and stick with it. In the end, it's not that important which one you choose. The fastest one you can start with is JavaScript. Just press F12 in your browser to open the DevTools and start typing "Hello World" in it. It takes only one keypress. There are also great [online editors](https://geekflare.com/online-code-editors/) you can make use of, altough I would rather recommend to use a local setup on your machine.

### Learn the fundamentals

Start with the fundamentals and repeat them everyday: data types, variables, arithmetic, if-conditions, loops, functions and so on. Some of them should look familiar to you from Karel The Robot. Learn the syntax and semantic of your programming language. In the beginning, it's not about knowing every feature, method or API that it offers. Start easy, learn the basics and take it slow. Future knowledge will build on this.

Moreover, don't get stuck in tutorial hell and waste your time watching endless tutorials on YouTube, Udemy or whatsoever where everyone is coding but you. You have to write your own code to learn programming. Try and fail. Make mistakes. If you get stuck on a problem, take a break. I don't know how many times I was lying in bed, sitting in the train or at the dinner table and the solution just came out of nowhere to my mind. It's amazing how our brain can solve problems in the background without actively paying attention to them.

Most important: build a daily habit. Code every day, even if it's just for a short period of time like 10 or 15 minutes. Repetition is the key to success.

### Learn the algorithms and data structures

Next, learn the algorithms and get used to what I call "computational" or logical thinking. This might be not easy. Take a problem, break it down into smaller ones and solve them step by step. Get used to a sequential workflow. Just as you did for Karel The Robot. Before writing the code, take a sheet of paper, make some sketches, draw a flowchart and try different approaches. When you're done, pick the next one and include solutions from problems you've solved before. Your first solution might not be the most efficient one. That's okay. Get your code working and improve it afterwards. But please don't copy solutions that you don't understand and take them for granted.

It's not about learning every algorithm out there for sorting an array, traversing a binary tree or finding the shortest path. Have a look at some existing algorithms and try to implement or even slightly modify them. Give [LeetCode](https://leetcode.com/) a try. It's a great website for doing coding challenges.

Moreover, get in touch with the most common data structures: Arrays, Lists, Queues, Stacks, Maps, HashTables, Trees. Try to use some of them when working on different problems. I could bet you will not use more than two or three of them in your future workday. Especially trees are rather uncommon.

In this step, you may also want to take a look at some concepts such as OOP or functional programming, depending on your language.

### Get back to the roots

Get back to the roots. Code without using a heavyweight IDE like IntelliJ or Visual Studio. Get rid of tools like Linters and Prettiers which highlight your code smells and autoformat your code. Get rid of fancy frameworks and libs that act like magical black boxes. Get rid of build tools that take more time building the project than the coding itself. They are unnecessary ballast.

Don't get me wrong, all these tools are amazing and I highly encourage you to use them in your later career. But in the beginning, they just distract you from your main goal: learning programming. Add them to your repetoir later on after you've learnt the fundamentals.

Keep in mind that you don't need much to get started. What you really need is a simple text editor and a compiler / interpreter for your programming language of choice. Above all, you don't need a +1000€ MacBook with fancy stickers on it, beside you want to fit the clichés. If you want to learn programming by creating the next [Crysis](https://www.crysis.com/), you might need one too.

### Teach others

In my opinion, sharing knowledge is one of the greatest things you can do with it. Schwarzenegger already said: "Help others and give something back". So share your expertise and new discoveries with others. Both, you and your learning partner, will highly benefit from it. Maybe start your own blog too?

The programming community is huge, take advantage of that and get into conversations. You can participate in discussions on platforms like [DEV](https://dev.to/) or [Stackoverflow](https://stackoverflow.com/), join multiple subs on [Reddit](https://reddit.com/) or attend local meetups in your area. In times of the Internet there are endless possibilities.

### Learn the tools

Once you know the fundamentals and some advanced concepts, go ahead and get familiar with tools like: GIT, Linters, IDEAs, Maven / Gradle / Webpack. Be amazed by IntelliJ's autocompletion and it's code analyzing capacity. Learn some common used libraries and frameworks for your programming language, but please don't end up coding dozens of similar CRUD REST-APIs.

Include these tools into your daily workflow and start working on your first "bigger" project. Make it open source and share it on [GitHub](https://github.com/) so other people can contribute and give feedback.

### Land an internship

Finally, after you have learnt the basics, some advanced concepts and tools, go ahead and apply for a software engineering internship near your location and surrond yourself with people that are more experienced than you. Especially when you're a student. The hands-on experience you gain may be worth much more than any course you'll ever take.

With that being said gain as much experience as possible: get in touch with production code, work in an interdisciplinary team, join discussions and code reviews, deploy applications, drop the live database (joke). And one of the most important things: ask questions, lots of questions!

Landing and internship can be hard, I know. You might have to run through multiple assessment centers, coding interviews / challenges and so on. Don't be discouraged when you fail your first ones. [Coding interviews are broken](https://www.youtube.com/watch?v=bx3--22D4E4).

## Last words

That's it. Sounds complicated? Yeah, it is. Don't let anyone tell you otherwise. It's no reason why you shouldn't start right now. Take your time, follow a plan and you'll make it. I promise. Go for it, you won't regret it.

Let me know if this article helped you or not.