Survey of Programming Language Lecture 1
Survey of Programming Language Lecture 1
LANGUAGE
Dr. E. Owusu
CONCEPTS OF PROGRAMMING
LANGUAGES
Increased capacity to express ideas.
C programming:
do { x = 2*x; }
while (x < 100);
Pascal programming:
repeat x := 2*x
until x >= 100;
Notice that the sense of the test is different: C exits the loop when
the condition becomes false, Pascal when it becomes true.
Syntax supports semantics
A language cannot have semantics
without syntax to support those semantics
C couldnt have a for loop without syntax
Java couldnt have objects without syntax for
creating and using them
Describing lists:
<ident_list> identifier | identifier, <ident_list>
Semantics is fundamental
Semantics affects the very way we think
about programming
Someone once said, You can write a
FORTRAN program in any language.
This is a poor way to program
You can use a language, or you can fight with it
If you are fighting with a language, you are either
using the wrong language, or
using the language wrong
Thinking in the language
In C, functional decomposition is the
preferred way to write a program
In Java, functional decomposition is one of
the worst ways to write a program
In Java, you need to:
Choose your set of objects carefully
Decide the behaviors of each kind of object
Decide how objects communicate and interact
Pragmatics
Pragmatics has to do with how well the
language connects to the real world
Semantics supports pragmatics: some
kinds of languages are better for some
kinds of problems
The choice of a language should depend
on pragmatic considerations
Examples of pragmatics
C is fast because it does so little error
checking
Java programs are less buggy because
they spend so much time on error checks
Perl is good for CGI scripts because it has
powerful tools for string processing
Java is a better choice for me than C++
because I know Java better
Assignment 1