Hello World! This article tries to express the concept of programming in an exciting way. Understanding the concept of programming is intriguing irrespective of your background. This article introduces you to the world of programming; Also, you do not necessarily need to be a programmer after this article, It just helps you understand the concept.
What is Programming?
Programming is simply the process of writing computer programs. So you are thinking what are computer programs? Right? A computer program is a list of instructions that we write using a programming language that our computer understands. There are several programming languages built by different developers but our computer doesn’t understand programming languages. Our computer understands machine language.
Machine language is a computer language consisting of binary or hexadecimal instructions that a computer can respond to directly.
Imagine if you have to write the above code as a programmer,( I’m not saying it’s impossible, of-course humans have the ability to do anything they set their minds to do.) very difficult right? So this is the entire point of programming languages, it saves us the stress of writing machine codes.
Converting Machine Code to Source Code
Our computer converts our source code to machine code by compiling or interpreting.
A compiler is a program on our computer that translates source code into machine code by creating an executable program(.exe). Examples of compiler languages include C++, C, Swift, C#, Java etc
An Interpreter directly executes instructions written in a programming or scripting language without previously converting them to object code or machine code. An interpreter takes source code and runs it line by line, it doesn’t convert the source code into an executable file. Examples include Javascript, Python, and PHP.
Rules of programming languages.
The rules of programming languages are similar across languages. In this article, we will be looking at case sensitivity, statements, pseudocode, comments, and keywords.
Case sensitivity
This is a common feature of several languages. Case sensitivity is described as a program’s ability to distinguish between uppercase letters and lowercase letters. For instance, food is not equal to Food. Examples of non-sensitive languages include SQL and FORTRAN.
Statements.
A statement is a unit of a programming language that describes the action to be carried out, computer programs are a compilation of statements. It is best practice to write every single statement in different lines for easy readability of your code. Sometimes, writing statements on different lines isn’t enough, you need to specify if the statement is complete, just like adding commas and full stops to the end of a sentence in English. The most common notation used in programming is the semi-colon.
The above is a simple statement in Python.
Pseudocode
Pseudocode is a detailed description of what a computer program is expected to do expressed in a natural-styled language. It is a step by step outline of your code that can be gradually translated into a programming language. It’s best practice to write your program steps and sequence in pseudocodes before writing your source code as this gives an understanding of the source code you intend to write. A lot of people assume pseudocode is for beginners but this isn’t true as pseudocode helps us think. There is no official syntax to writing pseudocode, you write it as it suits you. A great benefit of pseudocode is that it fosters collaboration as different programmers using different languages can come together and write something before switching into the source code. Another benefit is that it saves us the time of staring blankly at our screens, we already have an idea of the things program we plan to build.
Example of pseudocode.
Comments
Comments are readable explanations in the source code of a computer program, comments make the source code easier to understand and maintain, they are very important especially when writing a program that other people will still use. The compiler or interpreter ignores comments so they ain’t executed.
In the above source code, the computer ignored the greetings because it is a comment.
Keywords
Keywords are words that are reserved by programming languages because the word has a special meaning, it cannot be given any use by the programmer than what it was intended. Keywords vary across different languages. Below is a list of the keywords in python.