Programming means a set of instructions that tells a computer what to do to find a solution to a particular problem. Programs are written using a programming language. In this article, I will take you through the fundamentals of programming that you should know before stepping into programming.
A programming language is a formal language designed to communicate instructions to a computer. There are two main types of programming languages: low-level languages and high-level languages.
Fundamentals of Programming: Low-Level Languages
Low-level languages are referred to as “low” because they are very similar to how the different hardware elements of a computer communicate with each other.
Low-level languages are machine-oriented and require in-depth knowledge of computer hardware and its configuration. There are two categories of low-level languages: machine language and assembly language.
Machine language, or machine code, is the only language that is directly understood by the computer, and it does not need to be translated. All instructions use binary notation and are written as a string of 1s and 0s.
However, the binary notation is very difficult for humans to understand. This is where assembly languages come in.
An assembly language is the first step in improving the programming structure and making machine language more readable by humans. An assembly language is made up of a set of symbols and letters. A translator is needed to translate assembly language into machine language called “assembler”.
Although easier than machine code, assembly languages are still quite difficult to understand. This is why high-level languages have been developed.
Fundamentals of Programming: High-Level Languages
A high-level language is a programming language that uses English and mathematical symbols, like +, -,% and many others, in its instructions. When using the term “programming languages” most people are referring to high-level languages. High-level languages are the languages most often used by programmers to write programs.
Examples of high-level languages are C ++, Fortran, Java, and Python. Learning a high-level language is not unlike learning another human language — you have to learn vocabulary and grammar to be able to make sentences.
To learn a programming language, you need to learn commands, syntax, and logic, which closely correspond to vocabulary and grammar. The code of most high-level languages is portable, and the same code can run on different hardware without modification.
Machine code and assembly languages are hardware-specific, which means that the machine code used to run a program on a specific computer must be changed to run on another computer.
A high-level language cannot be understood directly by a computer and must be translated into machine code. There are two ways to do this, and they relate to the way the program is executed: a high-level language can be compiled or interpreted.
Fundamentals of Programming: Compiler vs Interpreter
A compiler is a computer program that translates a program written in a high-level language into the machine language of a computer. The high-level program is called “the source code”.
The compiler is used to translate source code into machine code or compiled code. It does not use any of the input data yet. When compiled code is executed, called “program execution,” the program processes the input data to produce the desired output.
An interpreter is a computer program that directly executes instructions written in a programming language, without requiring that they have been previously compiled into a machine language program.
The algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to achieve the desired output. Algorithms are usually created independently of the underlying languages, that is, an algorithm can be implemented in more than one programming language.
Qualities of a good algorithm:
- The inlet and outlet must be precisely defined.
- Each step of the algorithm must be clear and unambiguous.
- An algorithm should not include computer code. The algorithm should be written in such a way that it can be used in different programming languages.
I hope you liked this article on the fundamentals of programming that you should know before stepping into programming. Feel free to ask your valuable questions in the comments section below.