Introduction to Programming
Lecture 1 – BBT 4211 - Computer Programming Kurui Daniel
|
What is Programming?
• A simple answer would be, “Programming is the act of instructing
computers to carry out tasks.” It is often referred to as coding.
• So then, what is a computer program? A computer program is a sequence of
instructions that the computer executes.
• Computer in the definition above is any device that is capable of processing
code. This could be smartphones, ATMs, the Raspberry Pi, Servers to name
a few.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 2
An Analogy for Programming
• First, there are patterns to our every day lives. The universe operates in a
somewhat predictable way; For example—day and night, seasons, sunrise
and sunset. People go through routines such as rising in the morning, going
to school or to work. We get instructions from other people such as our
superiors at work. How we cook certain recipes can be explained in finite
steps.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 3
An Analogy for Programming Cont’d
• Second, every time we use smart devices, some code is running in the
background. Moving a mouse pointer from one part of your computer
screen to the other may seem like a simple task, but in reality, so many
lines of code just ran. An act as simple as typing letters into Google Docs
leads to lines of code being executed in the background. It’s all code
everywhere.
• Computer programs are also referred to as code. Do not use the word
‘codes’ (code should be used as an uncountable noun). Okay, this is not an
English class, let’s get back to business.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 4
The Natural Language of the Computer
• Machines have their natural language like humans do. Computers do not
understand the human language. The natural language of computers is the
binary code—1 and 0. These represent two states: on (1) and off (0).
• That is the natural language of electronic equipment. It would be hectic for
us as humans to communicate with the computer in binary.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 5
Enter Programming Languages
• To communicate with machines who speak binary, we do so in a language
that’s closer to our own natural language. Such as English, French, Swahili
or Arabic. Programming languages are close to our natural languages. But
they are more structured and must be thoroughly learned.
• They could be high level or low level languages. High level programming
languages are farther away from the machine language than low level
languages. This “farther away” is usually called an abstraction , but we will
not go into that in this series. Let’s not get distracted :)
• The computer needs a way to understand our human language. To do this,
we’ll need a translator.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 6
What are Translators
• Source code refers to code written in a particular programming language.
• Translators have the responsibility of converting your source code to the
machine language. This is also known as binary. Remember ones and zeros.
We may refer to the binaries as Object Code , the Program or a common
word today: App.
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 7
What are Translators Cont’d
Translators can be any of:
• Interpreters - processes the source code line by line and runs every line in the final program or app
• Compilers - Compilers translate all lines of a program to a file (binary) and execute the whole file
• A hybrid of Interpreters and Compilers - is a combination of the Interpreter and Compiler
• Assemblers - translating low-level Assembly language to binary
4/16/20 BBT 4211 - Computer Programming - Kurui Daniel | 8
End
Ole Sangale Road, Madaraka Estate. PO Box 59857-00200, Nairobi, Kenya
Tel: (+254) (0)703 034000/200/300 Fax : +254 (0)20 607498
Email:
[email protected] Website: www.strathmore.edu
|