2
Introduction to Programming Techniques: In this part you will learn about: How programming languages evolved How programs are translated Criteria for Evaluating Programming Languages Categories of programming languages How did Programming Languages evolve? (put link to document) Programming languages evolved through four main generations: - First Generation: Machine Language ( i.e. 0's and 1's). Those are the exact codes of machine operations. - Second Generation: Assembly Language ( which is a direct mapping of machine language from 0's and 1's into codes such as MOVE, ADD, ……) Assembly language programs are translated using into machine language assemblers. Systems software programs such as OSs and utility programs are often written in assembly languages. - Third Generation: To continue the trend toward greater use of symbolic code BASIC, COBOL, C and FORTRAN were developed as, high level, third-generation languages that use English which more closely resembles everyday human communication and understanding. Each statement in the languages translates into several instruction in machine language. Those languages are translated using a compiler or an interpreter. - Fourth Generation (4GLs) Fourth-generation programming languages emphasize on output results. They are designed to be used with little or no training in computers and programming, e.g. by managers and executives. Examples are: languages for accessing information in a database such as SQL (Structured Query Language), which is often used to perform database queries and manipulations. How are programs translated? Program Translation techniques can be categorized into two main categories: Compilation and Interpretation A compiler converts the source code program into the machine-languages instructions consisting of binary digits. A compiler creates a two-stage process for program execution. First, it translates the program into a complete machine language program; second, the CPU executes that program. Another approach is to use an interpreter, which is a language translator that converts each statement in a programming language into machine language and executes the translated statement, one at a time. Examples are C++ compilers (Borland C, Visual C), Pascal. A pure interpreter does not produce a complete machine- language program. After the statement executes, the machine-language statement is discarded, the process continues for the next statement, and so on. A typical example is BASIC in its early stages.

1 Introduction Introduction

Embed Size (px)

DESCRIPTION

Introduction to Programming Techniques

Citation preview

Page 1: 1 Introduction Introduction

Introduction to Programming Techniques:

In this part you will learn about:

• How programming languages evolved

• How programs are translated

• Criteria for Evaluating Programming Languages

• Categories of programming languages

• How did Programming Languages evolve? (put link to document)

Programming languages evolved through four main generations:

- First Generation:

Machine Language ( i.e. 0's and 1's). Those are the exact codes of machine

operations.

- Second Generation:

Assembly Language ( which is a direct mapping of machine language from 0's

and 1's into codes such as MOVE, ADD, ……) Assembly language programs

are translated using into machine language assemblers. Systems software

programs such as OSs and utility programs are often written in assembly

languages.

- Third Generation:

To continue the trend toward greater use of symbolic code BASIC, COBOL, C

and FORTRAN were developed as, high level, third-generation languages that

use English which more closely resembles everyday human communication

and understanding. Each statement in the languages translates into several

instruction in machine language. Those languages are translated using a

compiler or an interpreter.

- Fourth Generation (4GLs)

Fourth-generation programming languages emphasize on output results. They

are designed to be used with little or no training in computers and

programming, e.g. by managers and executives. Examples are: languages for

accessing information in a database such as SQL (Structured Query

Language), which is often used to perform database queries and

manipulations.

• How are programs translated? Program Translation techniques can be

categorized into two main categories: Compilation and Interpretation

• A compiler converts the source code program into the machine-languages

instructions consisting of binary digits. A compiler creates a two-stage process

for program execution. First, it translates the program into a complete machine

language program; second, the CPU executes that program. Another approach

is to use an interpreter, which is a language translator that converts each

statement in a programming language into machine language and executes the

translated statement, one at a time. Examples are C++ compilers (Borland C,

Visual C), Pascal. A pure interpreter does not produce a complete machine-

language program. After the statement executes, the machine-language

statement is discarded, the process continues for the next statement, and so on.

A typical example is BASIC in its early stages.

Page 2: 1 Introduction Introduction

A compromise between compilers and pure interpreters is obtained by

translating a high-level language program into an intermediate language that

allows easy interpretation. This is faster than pure interpretation. Examples are

Perl programs that are partially compiled to detect errors before interpretation.

Another example is Java. Java programs are translated into an intermediate

form called byte code, which provides portability to any machine that has a

byte code interpreter and a run-time system (together, these are called Java

Virtual Machine)

• What are the criteria for evaluating Programming Languages?

There are 3 main criteria for evaluating programming languages:

1. Readability: indicates how easy programs written in that language can be

comprehended. e.g. the availability of suitable control statement that can

model required actions, suitable data types, minimum multiplicity of

features

2. Writability: is related to how easy it is to express the logistics of a program

using that language. e.g. the availability of simple short cuts (such as ++

and += in C++), the possibility to define new data types with suitable

interface to facilitate use of corresponding objects.

3. Reliability: reliability is related to error checking, and measures for

avoiding run time errors. Of course there is a tradeoff between error

checking and speed of execution of a program.

4. Cost: This is not limited to the cost of developing and/or writing the

program. It includes costs for training programmers to learn the language,

costs for compiling and running the program, costs due to failure of the

program, and last, but definitely not least, costs for maintaining the

program. Maintenance costs may be as high as 2 to 4 times the costs of

development.

• How are programming languages categorized

The main categories of programming languages are:

– Imperative Languages: Those languages are based on constructs such

as variables and different statements (assignment, iteration ..).

Examples are C, C++, Java, Visual BASIC .NET, Perl

– Functional: In those languages computations are mainly performed

through functions. An examples is LISP

– Logic: Those languages are based on applying rules. A typical example

is Prolog

– Markup languages: such as XHTML are not real programming

languages. Recently, some features have been added to XHTML to

provide more programming capabilities such as JSTL (Java Server Tag

Library)