Anda di halaman 1dari 51

IT 1: Information Technology

Literacy
2
nd
Semester 2013-2014
PROGRAMMING LANGUAGES
A system for describing computation
A system of signs used by a person to
communicate a task/algorithm to a
computer, causing the task to be
performed
Programming Language
Set of commands that are formulated
by a user and executed by a
computer
Programming Language
PROGRAMMING LANGUAGE
PARADIGMS (WEGNER, 1989)
Pattern for modeling and solving
problems
The way we think of problems and
how they are going to be solved
Paradigm
Imperative Languages
Declarative Languages
Programming Language
Paradigms
Specifies how a computation is
performed
Computations are performed through
a guided sequence of steps in which
variables referred to are changed
Imperative Languages
To solve a problem, the step by step
procedure utilizing the storage of the
computer is specified
Imperative Languages
Block-Structured
The procedure is the building block of the
program
Object-Oriented
Languages that employ objects
Imperative
Imperative: Object-oriented
Pacman
Specify what is to be computed
Require the specification of a relation
or function
Declarative Languages
Logical
Based on a subset of predicate rules
Functional
Functions which return one value given a
list of parameters
Declarative Languages
valuable(gold). /*gold is
valuable*/
valuable(money). /*money is
valuable*/
father(john,mary). /*john is the
father of mary*/
gives(john,book,mary). /*john gives
book to mary*/
Example: Prolog (facts)
valuable(gold)? /*Is gold valuable?*/
Prolog Reply: yes
father(X,mary)? /*Who is the father of mary?*/
X = john
valuable(X)? /*Which objects are valuable?*/
X=gold
X=money
gives(john,X,mark),valuable(X)
/*Does john gives X to mark and X is valuable*/
Example: Prolog (queries)
POPULAR PROGRAMMING
LANGUAGES
FORmula TRANslation
First successful programming language
Designed by John Backus in 1956
Designed specifically for scientific and
engineering applications
Fortran
program hello
print *, "Hello World!"
end program hello
Hello World in Fortran
Universal programming language
designed in 1958 by a committee
composed of Americans and
Europeans
An attempt to improve FORTRAN
Most ingenious language definition
effort but never gained widespread
acceptance
Algol-60
Credited for:
Block structure
Compound statement
Recursion
Nested if
Loops
Arbitrary length identifiers
Algol-60
begin
file rmt (kind = remote);
write(rmt, <"Hello World!">);
end.
Hello World in Algol-60
Developed in the late 1950s by John
McCarthy
The algebraic syntax of Lisp was
borrowed from FORTRAN and the
methods of symbolic manipulation from
Information Processing Language (IPL)
The Lambda calculus and the Kleenes
recursive functions are the bases of Lisps
anonymous functions
Lisp
(DEFUN HELLO-WORLD ()
(PRINT (LIST 'HELLO 'WORLD)))
Hello World in Lisp
Common Business Oriented Language
Designed by the Conference on Data Systems
and Languages (CODASYL)
COBOL
Features:
Handles large files of data safely
Moves data around safely
Structures data explicitly
Does not have any need for complex
mathematical structures
Easy to program
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. Hello.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
Display 'Hello, World'.
STOP RUN.
Hello World in COBOL
String-Oriented Symbol Language
Designed in 1962 by a research group
at Bell Laboratories
Based on principle of pattern
matching to solve string manipulation
problems
SNOBOL
Features
String manipulation operations
Pattern matching
Dynamically typed
Interpretive language
SNOBOL
output = "Hello, world"
end
Hello World in SNOBOL
Beginners All Purpose Symbolic
Instruction Code
Developed by Thomas Kurtz and John
Kemeny in 1960s
Most used language on
microcomputers up to the late 1980s
~10-12 million school children learned
the language
BASIC
10 PRINT "Hello World!"
20 GOTO 10
Hello World in BASIC
Introduced in 1966 as a replacement
for all programming languages
PL/I = FORTRAN + COBOL + Algol
PL/I
HELLO: PROCEDURE OPTIONS
(MAIN);
FLAG = 0;
LOOP: DO WHILE (FLAG = 0);
PUT SKIP DATA('HELLO
WORLD!');
END LOOP;
END HELLO;
Hello World in PL/I
Simulation Language
Designed and implemented by Ole-
Johan Dahl and Kristen Nygaard from
1962-1967
SIMULA-67
Features:
Coroutines
Objects
Class construct
Class inheritance
SIMULA-67
Begin
OutText ("Hello World!");
Outimage;
End;
Hello World in SIMULA-67
Developed by Nicklaus Wirth in 1969
Objectives
Can be used to teach proper
programming techniques
Simple and logical for students
Can enforce principles of structured
programming
Pascal
Has the capability to define new data
types
Supported dynamic data structures
Can grow and shrink during the program
execution
Pascal
Features:
Case statement
User-defined types
Sets
Records
Pointers
Pascal
#include <stdio.h>
#define sub int
#define print(a) printf("%s", a)
sub main() {
print("Hello world\n");
}
#ifdef _perl
main();
#endif
Hello World in Pascal
Developed by Dennis Ritchie in 1972
Rich data typing (int, float, char, etc.)
Basis of most object-oriented
programming languages like C++ and
Java
C
#include <stdio.h>
main () {
printf (Hello World!\n);
}
Hello World in C
Programming in Logic
Developed by Robert Kowalski,
Maarten van Emden and Alain
Colmerauer in 1970
Powerful language in artificial
intelligence and non-numerical
programming in general
Prolog
Features
Use of logic to represent a world
Use of resolution theorem to represent
that world
Restriction to a class of formulas for which
the theorem prover is efficient
Use of logical/mathematical variables
Emphasis on list processing data structures
Prolog
go :-
writeln('Hello World').
Hello World in Prolog
Designed by Bjarne Stroupsup in early
1980s
C with classes
Allow the use of C language for
simulation
C++
Extends C in three ways:
support for creating and using data
abstractions
Support for object-oriented design and
programming
Various nice improvements over existing C
constructs
C++
#include <stdio.h>
main () {
cout >> Hello World;
}
Hello World in C++
Designed in 1991 by a group of Sun
Microsystems engineers led by James
Gosling
Can be:
A stand alone application
An applet that run on a web browser
Java
public class Hello {
public static void main(String []args) {
System.out.println("Hello World");
}
}
Hello World in Java
Evolution of programming
languages

Anda mungkin juga menyukai