How to start with programming

How to start with programming
Photo by Safar Safarov / Unsplash

I strongly believe that the best way to get started is to pick something you want to make and then research how to do it. But let's be honest here: "research" is mostly you googling what you need to accomplish or some bug you encounter and searching for a solution on stackoverflow or any other programming related site. - And that's completely fine! You should never reinvent the wheel for a problem you face, because someone will already have done it and others will have improved upon it. One single person can never now everything and most programmers i know, including myself, spend half the time on google. Its just how it is and if someone says that you are not allowed to google/research, they are an idiot.

What language do i choose?

Well, with that out of the way, the age old question arises:
"Which language do i code in?".

For you as a starter, my answer would be: "It depends on you want to do".

Let me explain:
You can choose many many languages to do the same thing, however depending on what device you code on, what device you want to code for and the task you want your program to do, there are differences in what languages you should prefer over others. For example you would not run NodeJS (JavaScript) or Python on a system with very limited amount of RAM and/or CPU performance. Instead you would choose something more bare-bones like C or C++ to get the maximum performance. If you want to code something that has a GUI, its easier to start with Python or C# (WPF/UWP/etc) instead of going for C/C++ or plain JavaScript (excluding NodeJS). Or maybe you want to write an app for Windows but also android at the same time? Then Dart/Flutter is the way to go.

If you are on a PC that runs Windows and only care about running an application on your PC right now, I would probably suggest Python. Python is not the fastest language and it definitely has its flaws - some might even say it's a bad language - however i disagree (somewhat). It's easy to install and run, easy to understand and you can do A LOT with it. It teaches you the very basics of programming, like variables, if statements, loops and what not in basically no time. And there is basically an infinite amount of PIP libraries that you can choose from to make whatever you want.

Here is an example of a "Hello World" application in Java:

class HelloWorld {
    public static void main (String[] args) {
       System.out.println("Hello World");

VS Python:

print("Hello World")

What do i code first?

Learning by doing vs textbook learning

Well, this is a tricky one. Many people would tell you to write a calculator app or some kind of "notes" app to start with but i personally think that's super boring and does not help you whatsoever. You'd get bored quickly and instantly lose any interested that brought you to this point. Instead, i like to tackle problems and learn as i try to solve it. You could ask yourself "What do i need?" or "What would make my life easier?". This could be anything from a program that deletes or moves some files automatically, a save-game editor, something to display real world data (for example the current weather or forecast) and so on. Believe me, EVERYTHING is possible with enough work and dedication. If you can think of it, you can make it.  However if you really can't think of anything, making a calculator is fine. Its just not "practical" and you are potentially done in half an hour or even faster.

If you haven't done it yet, now is a good time to install Python. There are many guides and tutorials out there so i wont get into this. I am sure you can read and make decisions on your own so off you go and continue reading once you are done.
(Visual Studio Code is a really good editor, you should use it.)

The process of creating

Alright, you are dedicated to make your first program, have everything set up, opened your first "" file in VSC and are ready to go? Perfect.

To learn to code, you should ask yourself "What does my program need to do?". Do you need user input? Download something from the internet? Do you need to store data for later use?

If you break down your idea into many of these question, you can easily google them and find the answer on your own. And that is what makes a good programmer! Believe it or not: If all you do is asking the right questions, you will get the right answers and eventually build something great. You probably came here to "learn coding" but instead i actually want you to understand and learn how to tackle your coding problems instead, so you can get smarter on your own and without relying on me or other people to answer your questions.

Don't get me wrong, if you have a person that is willing to teach you, you should definitely ask them for advice. Its super helpful to get an immediate answer to a problem you face but be aware that you should do some thinking on your own and maybe even do some research before you ask. That way, you can ask specific questions on possible solutions instead of just "It doesn't work. Why?".

Anyway, to give you an example, ill outline and then break down a simple forecast app.

I want to make a weather app that displays the current weather and information about the next few days in the terminal. Luckily, there is, which neatly displays everything in ASCII, so we can just print it to the screen. To get data from a different city, you can put a city name at the end of the domain, for example: york.

Now ask yourself, what does your program need to do?

I'd say you need to print out a prompt that asks for a city name and then get a users input, somehow download the data and then display it. I'll spare you with the research and answer it for you.

Prompt something on the screen: print
Ask for user input: input
Download something: requests

Now you can start coding. New questions will arise while you are coding and its your job to figure out how to deal with them, but i am sure you will manage.

import requests # importing a module (how to install and import a module)

print("Welcome to my forecast app. Please enter your city name:")
city_name = input("> ") # gets the users input into a "city_name" variable

url = f'{city_name}' # sets the url and includes the variable

try: # if something fails, stop and go to "except"
    data = requests.get(url) # downloads the data from the website
    forecast_text = data.text # "data" has more in it than just the text, but we just want that.
    print(forecast_text) # prints the forecast to the screen
    print("Error Occurred") # prints an error message if something fails.

Since the text from the website has special characters in it for colors, you can not run it with the windows terminal (cmd / command prompt) but should be used with the Visual Studio Code terminal. This is what it looks like:

There is really not much work put into this but the outcome is great because someone else did the heavy lifting for us. Sometimes people haven't done the heavy lifting and that's when you can step in and make something truly great. But whatever you do, its important that you have fun and set yourself small goals. You don't have to learn the entire language and know it from the back of your mind to be good, nor do you need to make something huge to be a good coder.

The principles you learn in python, as well as the questions you ask and the answers you get will help you in almost any language that you decide to tackle later. To me, most languages read like books in different dialects, because most things (if statements, variables, print, etc etc) exist in other languages too, maybe just with a slightly different name.

Anyway, i hope i could teach you how to teach yourself. Remember to have fun and if you have questions, drop by on our discord server.