0% found this document useful (0 votes)
26 views8 pages

1 - Introduction To Programming

Uploaded by

alpeshdudhat2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views8 pages

1 - Introduction To Programming

Uploaded by

alpeshdudhat2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

1.

2 Introduction to Programming
 A computer by itself will not do anything particularly useful.

 A program is a set of coded instructions that enables a machine to solve a


problem.
 A program directs the computer to
perform some specific task
 It is the ability to program a computer to

perform different tasks that makes


computers very powerful devices

 Theact of designing, implementing, and maintaining a program is called


programming

 A programming language signifies the syntax that can be used to write a program
 Programming languages are specifically designed for giving commands to a computer

1 22/03/2024
1.2 Introduction to Programming
 Machine Language
 Machine language is a type of programming language
 Machine language can be understood directly by a particular computer
 Simple instructions that can be executed directly by the CPU of a
computer
 These instructions represent the fundamental operations that the computer
can perform

The fundamental operations that most computers can perform include:


• Arithmetic operations
• Add, Multiply etc.
• Logic operations
• Is something true or false?
• Control Flow operations
• Used to determine the next instruction to carry out

2 22/03/2024
1.2 Introduction to Programming
 Machine Language
 Machine language is represented by a series of 1’s and 0’s that cause
the computer to perform a particular action.
 E.g., 1010101011010
 This is called a binary encoding
 The set of fundamental operations that a computer can perform and their
binary encodings is called the machine’s instruction set
 Different types of computers use different machine languages
 E.g., Intel Pentium processor vs. IBM PowerPC processor
 A program written in machine language is easy for a computer to
understand but very difficult for a human to understand just by
looking at it.

3 22/03/2024
1.2 Introduction to Programming
 Assembly Language
 We would like to have a language that was more natural for a human
to understand -> Assembly Language created
 Devise a set of abbreviations corresponding to the ML statements
 Developed a program to translate these abbreviations into ML
 We are still writing programs at a low-level when using assembly
 Instead of having to program in binary we can use a more natural language
 An assembly language instruction will typically have a corresponding
binary encoding

NOTE: When using assembly language we still need to know the details of the
machine being programmed, e.g., is it an Intel Pentium machine or an IBM
PowerPC machine.

4 22/03/2024
1.2 Introduction to Programming
 High Level Language (HLL)
 Instructions are represented using a set of statements which are similar
to human language (if, else, while etc.)
 Much faster to write program code in a HLL than Assembly or
Machine Language
 A compiler / interpreter is used to translate the HLL statements into
ML

NOTE: When using a high-level language we do not need to know the details of
the machine being programmed.

5 22/03/2024
1.2 Introduction to Programming
 Compilers & Interpreters

 Contextual Analogy
 Imagine you wish to be able to access the content of a book that is written
in a language with which you are unfamiliar.
 How could you get the book translated into a language that you do
understand?

Option 1: Get the entire book translated by Analogous to the


a translator and then receive a complete function of a
copy of the translated book. compiler

Option 2: Hire a translator to read the book Analogous to the


for you – translating each sentence one at a function of a
time. interpreter

6 22/03/2024
1.2 Introduction to Programming
 Syntax and Semantics
 The syntax rules of a language define how we can put symbols, reserved words,
and identifiers together to make a valid program. It is similar to the grammar of a
language.

 The semantics of a program statement define what that statement means (its
purpose or role in a program).

 A program that is syntactically correct is not necessarily logically (semantically)


correct

 A program will always do what we tell it to do, not what we meant to tell it to do

7 22/03/2024
1.3 Algorithms & Problem Solving
 Algorithms

 Itis effective, which means that an answer is


found and it finishes, that is it has a finite number
of steps.
 We can think of an algorithm as a set of
instructions which we must follow in order to
complete a task successfully.
 An example is a recipe that we must follow when
baking a cake.

8 22/03/2024

You might also like