Anda di halaman 1dari 19

SC015 COMPUTER SCIENCE

Unit Sains Komputer


Kolej Matrikulasi Kedah
7.0 Introduction to Programming
At the end of this topic, students should be able
to:
(a) Define programming language, programming
paradigm and language translators.
(b) Differentiate paradigm of programming
language; procedural, object oriented and
logic
(c) Differentiate types of language translators
(Compiler, Interpreter and Assembler)
Program and Programming
• Program is set of instructions that tells a
computer to perform tasks.
– Instructions must be written in a way that the
computer can understand.
– Created by a programmer using a programming
language.
• Programming is instructing a computer to do
something for you with the help of a
programming language.
Programming Language
• A set of words, symbols and codes that
enables a programmer to give instructions to a
computer.
• A set of commands that a computer has been
“taught” to understand.
• contains instructions for the computer to
perform a specific action or a specific task.
Types of Programming Language
• Low level language
– consists of strings of binary digits or English-like
abbreviations to represent instructions to
computer
• High level language
– Consists of a series of English-like words to
represent instructions to computer
Programming Paradigm
• Programming languages are categorized
according to the approach they use to solve a
problem.
• A paradigm is a way in which a programming
language looks at the problem to be solved.
Three (3) Programming Paradigm
• Procedural
• Object Oriented
• Logic
Procedural
• Programming paradigm which based upon the
concept of procedure calls, in which
statements are structured into procedures
(also known as subroutines or functions).
• Procedure calls are modular and are bound by
scope.
Object Oriented
• Programming paradigm which is based on the
concept of objects.
• Programmer identify objects which are items
that can contain both data and the procedures
that read or manipulate that data.
• Data and procedures are encapsulated.
Object Oriented
• An object is an item that can contain both
data and the procedures that read or
manipulate that data.
• An object represents a real person, place,
event, or transaction.
• Example of an object :
– Employee object– may consists employee’s name,
age, address, phone number, salary no.,
department, and salary
Object Oriented
• For example, the payroll program and health
benefits program both use the Employee object.
• That is, the payroll program would use it to
process employee pay checks and the health
benefits program would use it to process health
insurance payments
• Once programmer creates an Employee object, it
is available for use by any other existing or future
program.
• Programmer may reuse objects repeatedly.
Object Oriented
• Advantages:
– the ability to reuse and modify existing objects
– avoid programming redundancy
– programmers create applications faster
• Examples of OOP language:
– C++ , Java, Visual Basic
Logic
• Programming paradigm which is largely based
on formal logic.
• Any program written in a logic programming
language is a set of sentences in logical form,
expressing facts and rules about some
problem domain.
Language Translators
• A special program that translates
programming source code into machine
language.
Types of Language Translators
• Compiler
• Interpreter
• Assembler
Compiler
• A program that translates the entire source
code of high-level programming language into
machine language.
Interpreter
• A program that translates high-level
programming language into machine language
one line at a time.
Assembler
• A program that translates assembly language
to machine language.
End of SC015 Notes

Anda mungkin juga menyukai