An Introduction to Programming
In this course, we shall be discussing the various aspect of programming starting from the basics on to the advance levels.
Just in case you have ever wondered what programmers do, or you have wondering why you hear new buzzwords everyday, then you might likely find this course useful. This course is meant to set your mind on how to write codes or develop effective programming skills.
What is Programming?
"Programming (writing computer programs/software) is simply the process of instructing computers to carry out tasks.” Most times, this act is also referred to as coding. A computer program/software is a sequence of instructions that the computer executes while solving a given problem.
A Computer itself, can simply be seen as any device that is capable of processing code, including smartphones, ATMs, washing machines, tablets....... to mention a few.
It is interesting to note that each time you use any smart devices, there is some piece of code running in the background. To the computer user, these codes might not be seen, but for each action you take on any computing device (typing, drawing, chatting....), several lines of codes are being processed.
To start writing codes in computer science, the first thing you would want to know about is the meaning and the uses of programming languages. A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages generally consist of instructions for a computer , which helps the computer carry out or execute any given task. They can be used to create programs that implement specific algorithms.
A large number of programming languages have been created in the computing field, and many more still are being created every year. Many programming languages require computation to be specified as a sequence of operations (to be performed) while other languages use other forms of program specification whereby the desired result is specified, and then the problem would be how to achieve it.
Common programming Languages in 2018:
Some of the most popular programming languages so far include:
Depending on the task at hand, the programmer has the choice of selecting one or more of these languages to achieve the programming aim. The diagram below can give you a little bit of insight on how to go about choosing a particular language. The diagram shows that in the US, many computer science students would rather opt for "Python programming language". This could be simply be because the language is very easy to write and yet very versatile.
HOW COMPUTER UNDERSTAND
Computer and other electronic machines have their own language like humans do. They generally do not understand the human language. The only language computers speak and understand is the binary code (ones and zeros) — 1s and 0s. These represent two states: on (1) and off (0) in the computer's circuit board. Binary language (1s and 0s) is the natural language of electronic equipment.
In other to communicate with machines and computers, we use high level languages or low level languages ( Also known as programming languages) which are close to our natural languages. These high level (written in English or any other human language) must be structured and must be thoroughly learned, before we use them for coding.
In addition, before the computer understand these high level languages, they have to be translated using a translator.
Translators take the responsibility of converting our programs (source code - written in a particular programming language) to the machine language (binary code -which the computer understands - written in ones and zeros). The converted code is also known as Object Code.
Types of Translators
Translators are mainly classified into interpreters, Compilers, Hybrid Translators and Assemblers
An interpreter translate a source code line by line, executes each line before going on to the next line. While compilers translate all lines of a program to a file (binary file) and execute the whole file.
For interpreters, your program (source code) is processed line by line and runs every line in the final program. This means that interpreted source code starts running until an error is encountered. Then the interpreter stops to report such errors. Python programming language is a good example of an interpreted programming language.
Compilers convert the source code in its entirety via a compilation process to binary code (saved to a file). The binary is then executed. If there were errors in the source code, they are detected during the compilation time and flagged. C and C++ programming languages are examples of compiled programming language.
An executing (or a running) program use resources on a computing device such as memory, disk space and the file system. The time it takes to run such programs is known as the run-time of the program.
The programs we use on the computer are always associated with the platforms or environment in which they run, or are designed for. There are web applications (apps), which run on web browsers, such as Google Spreadsheet. There are mobile applications (apps), which run on smartphones such as CandyCrush. There are also desktop apps such as the Microsoftoffice desktop app.
A hybrid translator is a combination of the Interpreter and Compiler. A popular hybrid programming language is Java.
Assemblers are mainly for translating low-level Assembly language to binary.
Note that translators are computer programs on their own. You need to download or get them install them on your computer system and understand how they work before you can use them.