How to learn programming – 2021 Quickstart

First of all, let me address what programming is and how you should approach it so that we are on the same page and hopefully by the end of the article, you’ll be able to tackle and dismantle any programming language.
Trying to be concise, a programming language for the most part, is just like any verbal human language, we use human languages to tell other people what to do, we use programming languages to tell computers what do to, there are set of rules that every human language follows, so is the case with programming language, there’s “grammar” in human languages, similar to it there’s something called “syntax” in programming language. That’s basically it, so in this article we’ll go through what those rules are, what are those similar concepts that almost all programming languages use, if you have these things clear, learning any programming languages becomes a breeze, so let’s get started.
 
basics-of-programming
Basics of Programming

 

1. Variables and Datatypes:
Variable is an integral part of all programming languages, there are no programming language without variables.
According to Wikipedia “In computer programming, a variable is a storage location and an associated symbolic name which contains some known or unknown quantity or information, a value.”
Didn’t make sense?
Allow me to explain.
A variable can be thought of as a “special-word” that stores different kind of data for use later on.
Let’s say there’s a game that only two players play at a time, and the players are assigned a random name each time, so we can have two variables, let’s call them player1 and player2. When two players start the game, two names are randomly chosen and assigned to variables like this:
player1 = young thug
player2 = old thug
So now we use the variable player1 whenever we want to access player one’s name to do anything with it, the variable player1 points to the name/data  “young thug”, keep in mind that the variable doesn’t in itself stores the name “young thug”, but just the storage location which actually stores the name or data “young thug”. If this is too confusing for you at the moment, no worries, you can bluntly say the variable player1 has player one’s name and the variable player2 has player two’s name.
So now when two new players join the game, two new random names will be chosen and assigned to those variables like this:
player1 = goku
player2 = vegeta
2. Datatypes
So what are datatypes, if we separate the word, it becomes data-type and that’s exactly what it is, it’s the type of data that is stored in the variable. Remember in our previous example we did something like:
player1 = goku, now that is the right idea, but wrong “grammar” or “syntax” in all programming languages I’ve encountered yet. Why? because “goku” or “vegeta” is a alphanumeric word, i.e  a combination of alphabets and/or number. Its called a “String” datatype in programming language, and we cannot use string datatype like that, we need to enclose it in double quotes or  single quotes according to programming language, so correct usage will be:
player1 = “goku” and player2 = “vegeta”
So what other common datatypes are there, go ahead, I’ll give you 2.37 seconds to think.
Some other common datatypes are Integer datatype, used for integers and Double datatype used for decimal numbers. So why are datatypes important? Because many programming languages require you to define what kind of data a variable will store, so the variables we’ve used yet becomes:
String player1 = “goku”
String player2 = “vegeta”
Some programming languages don’t require you to define datatype while initializing variables but even so, your datatype  need to match one another for operations. For example:
Let’s say the two variables are:
var1 = “apple”
var2 = 23
and you do something like var1 + var2, guess what will happen? This time you guessed it right, it will not work, and there will be an error as you cannot add an integer to a string, just like in real life. Adding numeric data, adding integer or decimal number with each other works fine. So if your variables were
var1 = 46
var2 = 23
and you did something like var1 + var2, the result would be 69 as 46+23 = 69
So you can do something like var3 = var1 + var2 and it would be correct.

3. Control Structure

Third thing you must understand is control structure. Ok first let’s look at the boring official definition from Wiki:
“A control structure is a block of programming that analyzes variables and chooses a direction in which to go based on given parameters. The term flow control details the direction the program takes (which way program control “flows”). Hence it is the basic decision-making process in computing; flow control determines how a computer will respond when given certain conditions and parameters.”

I am too lazy too read that, so you can pause and read it if you’d like. I am moving on to explaining it now. Basically, even if you didn’t understand anything in the texts above, you can just think of control structure as the “flow of execution” of your program. Basically, there are thousands and thousands of line of code in your program. Control Structure define which part will be executed according to some condition, which part will be skipped and so on.

Let’s take a real world example, If you need to go and get milk what are the steps you take?
1. You get out of your bed
2. You get dressed if you were lying there all naked
3. You open the door
4. You go to the store
5. You buy Milk
6. You come back
That’s pretty simple for you to understand, but computers are dump machine, you need to tell them what to do exactly, and if it does something wrong, 100% of the time, you told it do to exactly that.

In programming, generally your code will be run or executed line by line, left to right for the most cases just like reading a book. But there can be different situations.
For example, let’s say you have a school app that shows some message according to whether a student failed or passed, so your code will be something like
if (marks >= 30){
print (“Congrats you passed”)
}
else{
print(“Oops, you turned out to be a failure”)
}
If you look into it closely, you might be able to guess that if a student got marks more than or equal to 30 passed and student who got less failed. So the computer uses information stored in variables and the logic we’ve coded to decide which part of the code will be executed and which will be skipped.
This was a simple example of control structure, there are more but you can learn more about them when you are learning a programming language. So we’ve learnt that a program executes line by line and can execute a specific code block according to conditions.
In-fact that is what makes a program useful, due to it’s ability to do different things according to data stored in variables.

4. Data Structures

In an actual program, there is a lot of code, and that calls for lot of variables and it can become a big deal to keep track of all the variables, data structures come to the rescue. Let’s say you have to save all the car companies and cars in variables, with the knowledge you have upto now, you can do something like:
car_company1 = “ford”
car_company2 = “chevrolet”
car_company3 = “tesla”
car_company4 = “honda”
and a lot more, I am lazy, good programmers are lazy, doing this for hundreds of car companies is not good at all, just imagine how much more variables you’d have to create for cars.
car1 = “benz”
car2 = “beamer”
car3 = “bently”
car4 = “ranger”
You see the pattern, soon you’ll be flooded by so many variables that it will become very difficult to manage. Data Structures allow you to store a lot of data in one variable. You can create something like this to store car company names:
car_companies = [“ford”,”chevrolet”,”tesla”,”honda”]
and similarly for cars like this:
cars = [“benz”,”beamer”,”bently”,”ranger”]
This is a very common data structure present in all the languages and is called an array. As you can see we have reduced the amount of variables by a lot. All our cars are stored in just 1 variable, and all our car companies are stored in just one variable. So realistically we’ve reduced the number of variables from possibly thousands to just two. And when you need to access the data stored in those variables, you can access in like this: car_companies[0], car_companies[1] and so one where car_companies[0] is ford, and car_companies[1] is chevrolet and so on.
There are a lot more data structures that facilitate data storing, but you get the idea and discussing all of them are beyond the scope here, you can check our detailed tutorial on python by clicking on the card in screen or the link in description.
5. Syntax
In the beginning, I talked informally about “grammar” or “syntax”, so now here’s the wikipedia definition: “In computer science, the syntax of a programming language is the set of rules that define the combinations of symbols that are considered to be correctly structured programs in that language.”
So basically what I had said earlier in a more formal way.
In English we have things like words . , ! and there’s a proper way to use them. We end a sentence with period (.), in programming like java, php and more, we end statements with ;
So, a proper statement looks something like this:
String var1 = “Hello World”;
Pause the video for 1.69 seconds, try to find our the rules in this statement.
Let me break it down for you.
1. String var1 : Here we are declaring a variable
2. = , this is called an assignment operator, it means we are about to assign a value to the variable var1
3. “Hello World”, this is a string value that is assigned to the variable var1
Learning syntax is lot simpler than learning the grammar in a human language. Nowadays the IDE provide syntax checking and help you fix your syntax error, if you are familiar with other concepts of programming, syntax will not be a challenge for you at all.
So that is it, I hope you are better equipped to learn any programming language of your choice and making your dreams a reality!Share for more free content! Peace.

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Sharing is caring!

5 thoughts on “How to learn programming – 2021 Quickstart”

  1. Nice content you can see the content. Today we will know How To Learn app programming. And how to become an app programmer will be discussed in detail, let's get started.
    Smartphones are here to stay and we can predict that they won’t go anywhere for at least two decades. Following this, we can claim that there will be high reliance on mobile apps for managing daily work, entertainment, business, health monitoring, etc.

Leave a Comment

Your email address will not be published.