Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Bachelor of Information Technology

PRG1002 - Programming I

Introduction to
Programming

“Programming is the act of instructing


computers to carry out tasks”
● What is a program?
Contents
● What is a programming language?

● History of programming languages

● High-level vs Low-level programming


languages
What is a program?
● A program is a sequence of instructions that tell a computer how to do a task.

● The computer is device that is used to execute all the instructions in a program.

● Let’s imagine you are giving directions to your friend on how to make his way to the nearby train
station.
○ In this situation, your friend is a computer, going to the nearest train station is the task, and the
directions are a sequence of instructions that tells him how to execute the task.

● The computers are dumb, they will only do what you tell them to do. This might make programming a
bit frustrating at first, but if you do everything right, you know exactly what the computer is going to
do.
How do we write a program?
● Computers have their own language like humans do.

● Computers do not understand the instructions given in human language.

● The natural language of computers is the binary code - 1 and 0.


○ 0 represents off.
○ 1 represents on.

● If we wanted to tell a computer what to do directly, we could give instructions in 1s and 0s.

● However, this is nearly impossible so we use a programming language.


What is a programming language?
● A programming language is close to our natural languages which allows us to write instructions to the
computer.

● The programming language make it easier for us to understand and potentially common to a number
of computer architectures.

● The computer does not understand programming languages directly, they use compiler or interpreter
to convert our language into machine code (0s and 1s).
What happens to the computer program?
● Compilers convert the entire program via a compilation process to machine code before it is used.
○ If there are errors in the program, they are detected during the compilation time and reported
back to us, and no machine code is generated.

● Once successfully generated, the machine code is then executed as a separate step.

● Languages like C++ are compiled, but some languages like JavaScript are interpreted directly.

● Interpreters process the instructions line by line and run the program in the interpreter execution
environment. It runs until it encounters an error in the program.
History of programming language
● The assembly language in the 1940s was probably the first human-readable programming language.

● By 1950s computer engineers realised the assembly language consumes too much time and was
error-prone to build a large program.

● In 1957, the first widely used, high level programming language called FORTRAN was created and
used for science computations.

● After FORTRAN, many programming languages were created.


History of programming language
● 1957 - FORTRAN
● 1959 - COBOL
● 1964 - BASIC
● 1969 - C
● 1970 - PASCAL
● 1983 - C++
● 1987 - PERL
● 1991 - PYTHON
● 1993 - RUBY
● 1995 - PHP
● 1995 - JAVASCRIPT
● 1996 - JAVA
High-level vs Low-level
● Low-level programming is close to machine code, high-level programming is closer to natural
languages.

● Assembly language is an example of low-level languages.

● Assembly language is a direct translation of the binary instructions the computer executes - each
assembly language instruction directly relates to one in machine code.

LUI R1, 1
LUI R2, 4
DADD R3, R1, R2

● This just did the calculation 1 + 4 = 5. The first two lines load the numbers “1” and “4” into computer’s
memory, and the third instruction tells the computer to add the values together and store the result.
Level of programming languages
● High-level programming language looks more like a natural languages.

● Python, Java and Lua are all examples of high level programming languages.

● The high-level languages are easier to write programs, but slower than the low-level languages.

● C/C++ are medium level languages, a lot of time we don’t think about machine code when writing a
program in C/C++ but we can if we want to.
Summary
● Program is a set instructions given to the computer.

● Instructions are stored in the computers as 1s and 0s.

● We use programming languages to write a program.

● Programs can be compiled or interpreted.

● There are lots of programming languages.

● There are high and low-level of programming languages.


References
Wikiversityorg. 2019. Wikiversityorg. [Online]. [1 July 2019]. Available from:
https://en.wikiversity.org/wiki/Introduction_to_Programming/About_Programming

Freecodecamporg. 2017. Developer News. [Online]. [1 July 2019]. Available from:


https://www.freecodecamp.org/news/a-gentler-introduction-to-programming-1f57383a1b2c/

Wikipediaorg. 2019. Wikipediaorg. [Online]. [1 July 2019]. Available from:


https://en.wikipedia.org/wiki/Timeline_of_programming_languages

Tutorialspoint.com 2019. Www.tutorialspointcom. [Online]. [1 July 2019]. Available from:


https://www.tutorialspoint.com/computer_programming/computer_programming_overview.htm

You might also like