You are on page 1of 20

PROGRAMMING LANGUAGE

Phu HUYNH
hdcphu@hotmail.com
LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Explain the concept of programming languages;
2. State the five generations of computer languages;
3. Identify six characteristics of programming language; and
4. Identify different types of programming languages.
PROGRAMMING LANGUAGE
• Computer requires instructions from humans to perform tasks
• We use programming language to communicate with and instruct the
computer
• To write a program, we need to know the words, symbols and syntax
of the programming language is used
WHY DO WE NEED TO KNOW
PROGRAMMING LANGUAGES?
Benefits of Understanding Programming Language
• Recognising the advantages and limitations of various programming
languages and where it is suitable to use each of them
• Produces more efficient solutions
• Influences users' thinking in solving problems
• Tools for solving problems using the computer
After mastering one programming language, it is easy to master
another one, because the programming concept is the same - only the
language syntax changes (!?)
PROGRAMMING LANGUAGE
GENERATIONS

• 1st Gen. machine language: optimize program, difficult, rarely used dependent
on the computer brand.
• 2nd Gen. assembly language: easier and more effective, dependent on the
computer brand, uses symbols and words, needs to be converted into the
machine language
PROGRAMMING LANGUAGE
GENERATIONS
3rd Gen. High-level language:
The reasons for the invention of the high-level languages:
• To simplify writing
• To enable a program to run on more than one machine, as it only needs to be
recompiled
• To enable a programmer to concentrate on fulfilling users' needs

Source codes are programs that are written in high-level languages, which need
to be converted to machine language, called object codes
3 types of language processor: Assembler, Compiler, Interpreter
PROGRAMMING LANGUAGE
GENERATIONS
4th Gen. problem-oriented language:
• Designed to handle a particular class of problem. For example, COBOL
was designed for business, FORTRAN for scientific, GPSS for
simulation and SQL for database management.
• The instructions resemble English language.
• Will not replace the third generation language because it focuses
more on one task
5th Gen. natural languages: same as the query languages except that
users are not required to learn words, grammar and syntax (AI)
APPROACH: CLASSIFICATIONS OF
PROGRAMMING LANGUAGES
Imperative Language
• Imperative means instruction, order or command
• “Do A, then, do B”
• The basic idea in imperative language is that users need to state every
step that is required in solving the problem.
Object-oriented Language
• Object-oriented language (OOL) is a high-
level computer programming language
that implements objects and their
associated procedures within the
programming context to solve a COMPLEX
problem.
• Advantages of object-orientation are ease
of system management
• Makes a program easier to design and
understand, focus on objects inside a
system, not on functions that occur inside
the system.
Object-oriented Language
Logic-based Language
Based on logic, facts and rules.
Ex: The rich and famous people is happy. The
yound and in-love people is happy. The old
and wise people is happy. Actors and singers
are famous. Ali is a rich actor. Is Ali happy?
happy (x) <- rich (x), famous (x)
happy (x) <- young (x), in-love (x)
happy (x) <- old (x), wise (x)
famous (x) <- actor (x)
famous (x) <- singer (x)
actor {ali}
rich {ali}
? - happy (ali)
Function-based Language
• Programs are constructed by applying and
composing functions. It is a declarative programming
paradigm in which function definitions are trees of
expressions that each return a value, rather than a
sequence of imperative statements which change
the state of the program.
• A traditional imperative program might use a loop to
traverse and modify a list. A functional program, on
the other hand, would probably use a higher-order
“map” function that takes a function and a list,
generating and returning a new list by applying the
function to each list item.
Function-based Language
Advantages:
•Bugs-Free Code
•Efficient Parallel Programming
•Efficiency
•Supports Nested Functions
•Lazy Evaluation
- requires a large memory space. As it does not have state, you need to
create new objects every time to perform actions.
Functional Programming is used in situations where we have to perform
lots of different operations on the same set of data.
Script
• A scripting or script language is a programming language for a special
run-time environment that automates the execution of tasks
• Portable between various types of computer platforms
• The tasks could alternatively be executed one-by-one
• Scripting languages are
often interpreted
Visual Language
COMMON PROGRAMMING LANGUAGES
• C/C++
• C#
• Java
• Perl
• Python
COMPILER, ASSEMBLER, INTERPRETER
Homework
• Download the Google spreadsheet,
• Split the student full name in column B to last & middle name into
column C and first name into column D (see example at cell B2, C2, D2) (1
point)
• Calculate the total bonus at column M (1 point):
• If the student was absent without notice for more than 3 times (more than 3
empty cells) then the total bonus = 0
• Else total bonus of a student = sum of all numeric value from column E to
column L of the student.
for example cell M2, the student don’t have any absence without notice so the
tol bonus = sum from E2 to L2

You might also like