Lect 2. Introduction To Programming Languages
Lect 2. Introduction To Programming Languages
2. A programming language is a set of rules that provides a way of telling a computer what
operations to perform. A programming language is a set of rules for communicating an
algorithm It provides a linguistic framework for describing computations
5. Why does some people speak French? Programming languages have evolved over time
as better ways have been developed to design them. ◦ First programming languages were
developed in the 1950s ◦ Since then thousands of languages have been developed
Different programming languages are designed for different types of programs.
6. High-level program class Triangle { class Triangle { ... ... float surface() float surface() return
b*h/2; return b*h/2; } } Low-level program LOAD r1,b LOAD r1,b LOAD r2,h LOAD r2,h MUL
r1,r2 MUL r1,r2 DIV r1,#2 DIV r1,#2 RET RET Executable Machine code
0001001001000101 0001001001000101 0010010011101100 0010010011101100
10101101001... 10101101001...
10. Closer to English but included simple mathematical notation. ◦ Programs written in source
code which must be translated into machine language programs called object code. ◦ The
translation of source code to object code is accomplished by a machine language system
program called a compiler.
12. A high level language (4GL) that requires fewer instructions to accomplish a task than a third
generation language. Used with databases ◦ Query languages ◦ Report generators ◦ Forms
designers ◦ Application generators
13. Declarative languages Functional(?): Lisp, Scheme, SML ◦ Also called applicative ◦
Everything is a function Logic: Prolog ◦ Based on mathematical logic ◦ Rule- or Constraint-
based
14. Though no clear definition at present, natural language programs generally can be
interpreted and executed by the computer with no other action by the user than stating their
question. Limited capabilities at present.
16. Two broad groups ◦ Traditional programming languages Sequences of instructions First,
second and some third generation languages ◦ Object-oriented languages Objects are
created rather than sequences of instructions Some third generation, and fourth and fifth
generation languages
17. FORTRAN ◦ FORmula TRANslation. ◦ Developed at IBM in the mid-1950s. ◦ Designed for
scientific and mathematical applications by scientists and engineers.
20. C ◦ Developed by Bell Laboratories in the early 1970s. ◦ Provides control and efficiency of
assembly language while having third generation language features. ◦ Often used for system
programs. ◦ UNIX is written in C.
21. Simula ◦ First object-oriented language ◦ Developed by Ole Johan Dahl in the 1960s.
Smalltalk ◦ First purely object-oriented language. ◦ Developed by Xerox in mid-1970s. ◦ Still
in use on some computers.
22. C++ ◦ It is C language with additional features. ◦ Widely used for developing system and
application software. ◦ Graphical user interfaces can be developed easily with visual
programming tools.
23. JAVA ◦ An object-oriented language similar to C++ that eliminates lots of C++’s problematic
features ◦ Allows a web page developer to create programs for applications, called applets
that can be used through a browser. ◦ Objective of JAVA developers is that it be machine,
platform and operating system independent.
24. Scripting Languages ◦ JavaScript and VBScript ◦ Php and ASP ◦ Perl and Python
Command Languages ◦ sh, csh, bash Text processing Languages ◦ LaTex, PostScript
25. HTML ◦ HyperText Markup Language. ◦ Used on the Internet and the World Wide Web
(WWW). ◦ Web page developer puts brief codes called tags in the page to indicate how the
page should be formatted.
26. XML ◦ Extensible Markup Language. ◦ A language for defining other languages.
27. Programming languages are languages When it comes to mechanics of the task, learning
to speak and use a programming language is in many ways like learning to speak a human
language In both kind of languages you have to learn new vocabulary, syntax and
semantics (new words, sentence structure and meaning) And both kind of language require
considerable practice to make perfect.
28. Computer languages lack ambiguity and vagueness In English sentences such as I saw
the man with a telescope (Who had the telescope?) or Take a pinch of salt (How much is a
pinch?) In a programming language a sentence either means one thing or it means nothing
29. Formerly: Run-time performance ◦ (Computers were more expensive than programmers)
Now: Life cycle (human) cost is more important ◦ Ease of designing, coding ◦ Debugging ◦
Maintenance ◦ Reusability FADS
30. Writability: The quality of a language that enables a programmer to use it to express a
computation clearly, correctly, concisely, and quickly. Readability: The quality of a
language that enables a programmer to understand and comprehend the nature of a
computation easily and accurately. Orthogonality: The quality of a language that features
provided have as few restrictions as possible and be combinable in any meaningful way.
Reliability: The quality of a language that assures a program will not behave in unexpected
or disastrous ways during execution. Maintainability: The quality of a language that eases
errors can be found and corrected and new features added.
31. Generality: The quality of a language that avoids special cases in the availability or use of
constructs and by combining closely related constructs into a single more general one.
Uniformity: The quality of a language that similar features should look similar and behave
similar. Extensibility: The quality of a language that provides some general mechanism for
the user to add new constructs to a language. Standardability: The quality of a language
that allows programs written to be transported from one computer to another without
significant change in language structure. Implementability: The quality of a language that
provides a translator or interpreter can be written. This can address to complexity of the
language definition.