Programming is the process of converting ideas into set of instructions for the computer to execute.
These instructions need to be specific and sequential.
Programming is similar to how we make a recipe. Take for example, you want to prepare a plate of rice.
There will be a certain amount of water in the pot and all other ingredients too must be in certain proportions.
And secondly, you add each ingredient in the right other.
What Is Programming Language
Programming language is what is use to provide instructions for the computer.
There are thousands of them and each has its own syntax also called rules, and semantics also called meaning.
You can liken this to human language too.
The way you will write WELCOME in Spanish is different from how you will write it in English.
Though the meaning (semantics) is the same but the writing rule (syntax) is different.
You may ask: Why do we have different languages when we can just use one to give instructions to the computer?
The answer is because each of these languages has its own strengths and weaknesses.
Some are better used for light applications while some can be used for complex mathematical calculations.
Eventually, each language is converted to low-level language that the computer understands (0s and 1s).
We use high-level language since it is difficult for human to give instructions to the computer in 0s and 1s.
What Is Source Code
Source code is the instruction that programmers write to the computer and it is written in plain text.
That means you can’t write source code using applications like Microsoft Word because it adds some other information to each character.
You write source code using application that saves each character as they are.
A good example is the Notepad on Windows computers and TextEdit on Mac.
For example, you want to write the Hello Word! in Python.
Open your Notepad and type in:
print (“Hello World!”)
Each programming language has an extension that the computer use to recognize its source code.
Now save the Notepad document using helloworld.py as filename and set the Save as type as All Files.
How To Run Your Source Code
Try to run your source code and see what happens.
The code will not run because Python is an interpreted language.
What that means is this:
You need an interpreter that will interpret each line of the source for your computer to understand.
If you remember, computer only understand machine language and the source code is written in high level language.
Take for example:
You’ve got a Spanish friend that doesn’t understand English and you wrote a letter to him.
Your friend will need someone to interpret the letter to him.
That is what computer language interpreter does. It interprets the source code line after line into machine language for the computer.
Some other computer languages uses a compiler to turn the source code into machine language.
A compiler is little different from interpreter.
It turns the whole source code into what the computer will understand at once – not line by line.
Let’s use your Spanish friend example again.
Assume that you have someone that speaks both language turn your English letter into Spanish and you send the Spanish version to your friend.
That is what compilers do.
Python uses both compiler and interpreter. Another example is Java.
C and C++ use only compiler.
You can write all your source code using a text editor but most programmers use IDE.
Integrated Development Environment.
Just like you use MS Word for easy formatting of your letter. IDEs make source code writing easy fro programmers by providing all the functionalities needed.
Like auto complete, color coding keywords etc.
There are many IDEs
Example: Xcode use to write iPhone apps, Visual Studio Code, Notepad++ and many more.
Computer programs are made up of statements.
It is the building block of program.
Statement can be KEYWORD, OPERATOR, or EXPRESSION
Operators are +,-,* and /.
When you give input to operator, you get expression.
Expression is 3 + 2