Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Lesson 2 - Overview of Programming

Overview of computer programming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lesson 2 - Overview of Programming

Overview of computer programming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Lesson 2 –

Overview of
COMPUTER
PROGRAMMING
Mrs. Florencia R. Payawal
Teacher III
Sta. Lucia High School 1
Introduction to Programming
Program
❖ The term program refers to a set of instructions that
instructs a computer on what to do. Programs are
Solutions to Problems, and they are written using
programming languages.
❖ A program can instruct a computer to:
– Read/ accept Input data
– Calculate or compare
– Store data
– Write or display Output and communication messages.
❖ The term software refers to a computer program or set
of programs and its associated documentation such as
user guide, technical manual 2
Programming Languages
• Programming: This refers to the process of
writing computer programs using a programming
language.
• The person who write such instructions is a
programmer.

3
Programming Languages

• Each natural language has a systematic method of using


symbols of a language. This is dictated by rules of grammar –
semantic (structure)and syntax (words and symbols)
• Similarly, computer programming languages are governed by
the structure and syntax.
• In natural languages one can break the syntax rule such but
we can use inference (guesswork) to get what the person
means.
• However, computer being a machine are receptive to only the
exact syntax rules of the language being used.

4
Types of Programming Languages

• A programming Language - is a set of rules that


provides a way of writing instructions that instructs a
computer on what operations to perform.
• Programming languages can be classified into two
broad categories namely:
1. Low level languages further classified into two
generations namely:
– First Generation- Machine languages
– Second Generation -Assembly languages

5
Types of Programming
Languages
2. High-level languages further classified into
three generations namely:
– Third Generation- Procedural languages
– Fourth Generation - Problem-oriented
languages
– Fifth Generation - Natural languages

6
Low Level Languages
MACHINE LANGUAGES (1GL)
• This is the oldest form of computer programming.
Plug boards were used to represent data in binary
(machine) form in the computer circuitry. Data
represented in 1s and 0s are said to be written in
machine language. For example, the code below
represent a segment of a machine code:
– 1011010100
– 1010111101
– 1000100100
• Machine language also varies according to make of
computer – another characteristic that make them
hard to work with.
7
ASSEMBLY LANGUAGES (2GL)
Assembly language use mnemonics such as ADD
that are automatically converted to the appropriate
sequence of 1s and 0s by a translator called
assembler. Compared to machine languages,
assembly languages are much easier for humans to
understand and to use. The machine language code
we gave above could be expressed in assembly
languages as:

ADD 210(8,13),02B(4,7)
PACK 218(8,13),02F(4,7)
MP 212(6,13),21D(3,13)
8
Advantages of low-level programming
languages
1. They are executed very fast since no translator
or minimum translation is involved.

2. They require very little memory space.

3. They have a high level of security since a


program written in machine language is difficult
to change or alter.
9
Disadvantages of low-level programming
languages

1. Machine languages are time-consuming


because the binary code instructions are
complex.
2. They are difficult to understand.
3. They are difficult to debug and hence
difficult to maintain.
4. They are not portable i.e can only be used by
specific computers.
10
High level languages
PROCEDURAL LANGUAGES (3GL)
• Procedural languages, also known as third
generation languages uses human like language.
They are intended to solve general problems.
Examples of procedural languages are C, Pascal,
FORTRAN, COBOL etc.
• Like assembly languages, procedural languages
must be translated into machine language so that
the computer processes it. Depending on the
language this translation is performed by either a
compiler or an interpreter. 11
High level languages-Translators
• A compiler converts the programmer's procedural
language program, called the source code, into a
machine language called the object code. This object
code can then be saved and run later. Examples of
procedural languages using compilers are the standard
version of PASCAL, COBOL, and FORTRAN.
• An interpreter converts the Procedural languages one
statement at a time into machine code just before it is to
be executed. No object code is saved. An example of
procedural language using an interpreter is the standard
version of BASIC. 12
Translation process

IF GRADE >=40 THEN


Source code PROCEED
ELSE
(high-level languages)
RESIT EXAM

(Compiler/Interpreter)

10010101001010001010100
Object Code 10101010100011101111011
(machine language)) 10110111100011100101011
13
PROBLEM-ORIENTED LANGUAGES
(4GL)
• Unlike general purpose languages, problem-oriented
languages are designed to solve specific problems.
While 3rd GLs focus on procedures and how a
program will accomplish a specific task, 4th GLs are
non-procedural and focus on specifying what the
program is to accomplish. 4th GLs are more
English-like, easier to program, and widely used by
non-programmers . Some of these 4thGLs, are used
for very specific applications. 4th GLs includes query
languages e.g. SQL and application generators eg
Visual Basic 14
NATURAL PROGRAMMING LANGUAGES
(5 GL)
• As they have evolved through the generations, computer languages have
become more human-like. Clearly, the fourth-generation query languages
using commands that include words like SELECT, FROM and WHERE, is
much more human-like than the 0s and 1s of machine languages. However,
5th GLs are still long way from natural languages such as English and
Spanish that people use.

• The standard definition of a 5th GL is a computer language that


incorporates the concepts of artificial intelligence to allow direct human
communication. Examples are PROLOG, LISP etc. Additionally, these
languages would enable a computer to run and to apply new information as
people do. Rather than coding by keying in specific commands we would
communicate more directly to a computer using natural languages or human
languages such as English or Spanish.
15
NATURAL PROGRAMMING LANGUAGES
(5 GL)
Consider the following natural language statement that
might appear in a 5th GL program for recommending
medical treatment:

Does Bill like chips?;


likes(bill, chips).

Recently, the definition 5th GL has been expanded to


include Visual Programming Languages such as Visual
PROLOG that provide a natural interface for program
development. This interface provides intuitive icons,
menus and drawing tools for creating program code.
16
Advantages of high-level languages
1. English-like phrasing of high-level languages
makes them easy to understand.
2. High level languages are portable i.e They are
transferable from one computer to another.
3. They are user-friendly and easy to use and
learn.
4. They are more flexible; hence they enhance
creativity of the programmer and increase
productivity in the workplace.
5. High level languages are far much easier to
debug.
17
Disadvantages of high-level languages

1. Their nature encourages loading of


instructions in a word or statement
hence the complexity of these
instructions cause slower program
processing.
2. They have to be interpreted or compiled
for translation to machine language
before the computer can trace them.
18

You might also like