You are on page 1of 21

Programming Languages Concepts

Lecture 1: Preliminaries
Prof. Nidal F. Shilbayeh

Chapter 1: Preliminaries

Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language Design Tradeoffs Implementation Methods Programming Environments
Prof. Nidal F. Shilbayeh 2

Chapter 1: Preliminaries

Reasons for Studying PLC


Increased capacity to express ideas Improved background for choosing appropriate languages Increased ability to learn new languages Better understanding of significance of implementation Increased ability to design new languages Overall advancement of computing
Prof. Nidal F. Shilbayeh 3

Chapter 1: Preliminaries

Increased capacity to express ideas

The language in which software is developed places limits on


Control structures Data structures Abstractions that can be used

Awareness of a wider variety of programming language features can reduce such limitations

Features in one programming language can often be simulated in another programming language

The study of PLC builds an appreciation for language features and encourages programmers to use them
Chapter 1: Preliminaries Prof. Nidal F. Shilbayeh 4

Improved background for choosing appropriate languages

Many professional programmers have had


little formal CS training CS training in the distant past

As a result, programmers tend to use the language with which they are most familiar, even if it is poorly suited to the task at hand Familiarity with a wide variety of languages puts the programmer in a better position to make informed language choices
Prof. Nidal F. Shilbayeh 5

Chapter 1: Preliminaries

Increased ability to learn new languages

Learning a new programming language can be difficult for someone who knows only one language A thorough understanding of PLC makes it much easier to see how language concepts are incorporated into the language being learned

Understanding data abstraction facilitates learning how to construct ADTs in C++ or Java Understanding PLC and its terminology makes it easier to understand programming language and compiler manuals
Prof. Nidal F. Shilbayeh 6

Chapter 1: Preliminaries

Better understanding of the significance of implementation

Understanding how features are implemented

Helps to write efficient codes and improves debugging skills ability to use a language more intelligently ability to use a language more efficiently when there is a choice among several constructs Example: recursion vs. iteration

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

Increased ability to design new languages

Programmers occasionally design languages of some kind or another

Software system user interface


interface design involves PLC techniques such as lexical analysis and parsing Criteria for judging user interface are similar to those used to judge programming language designs

The design of a language influences the complexity of the algorithms used to translate it

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

Overall advancement of computing

Why does a particular programming language become popular?


Best suited to solving problems in a particular domain Those in positions to choose are familiar with PLC Those in positions to choose are NOT familiar with PLC ALGOL more elegant with better control statements Programmers found ALGOL description difficult to read and concepts difficult to understand
Prof. Nidal F. Shilbayeh 9

ALGOL 60 vs FORTRAN in the early 60s

Chapter 1: Preliminaries

Programming Domains

Scientific applications Business applications Artificial intelligence Systems programming Scripting Languages

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

10

Programming Domains: Scientific applications

Characterized by the following features:


Simple data structures are needed: most common data structures are arrays and matrices. Problems require large numbers of floating-point arithmetic computations. Most common control structures are counting loops and selections FORTRAN is the most commonly used language in this domain.

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

11

Programming Domains: Business applications

Characterized by the following features:


Production of elaborate reports Need of precise ways for describing and storing character data (strings) and decimal numbers. Ability to specify decimal arithmetic operations COBOL is the most commonly used language in this domain.

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

12

Programming Domains: Artificial intelligence


Symbols rather than numbers manipulated AI problems (game playing, theorem proving, knowledge representation and reasoning, natural language processing, . . . etc) require information to be represented in symbolic form rather than numeric form Symbolic data is conveniently represented using linked lists (for names) and logical formulas (for facts and rules). The most commonly used languages in this domain are LISP for list representation of data and PROLOG for logical formula representation of data.
Chapter 1: Preliminaries Prof. Nidal F. Shilbayeh 13

Programming Domains: Systems programming

Systems software consists of the operating system and all the programming tools that support a computer system. These programs are mainly used for the operation of the computer system. A language used to write software in this domain must provide low-level features that allow software interfaces to external devices to be written. They must also provide for fast execution. C is the most commonly used system programming language. Includes OS and support tools.
Chapter 1: Preliminaries Prof. Nidal F. Shilbayeh 14

Programming Domains: Scripting Languages

A script is a file that contains a list of commands to be executed by an operating system. A scripting language is used to describe scripts. These languages also have variables, control flow statements and functions Among other capabilities.

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

15

Programming Domains: Scripting Languages (Cont.)

Some of these languages are:


Ksh: is powerful and widely known. awk: began as a report generation language; but has developed to a general purpose language. perl: convenient to write Common Gateway Interface (CGI) programs for the World Wide Web. JaveScript: used to develop programs for Web servers and browsers. It is used mostly as a client-side scripting language: JavaScript code is embedded in HTML documents and is interpreted by a browser that displays the document. PHP: is a scripting language for use on Web server systems. Like JavaScript, PHP code is embedded in HTLM documents, and is interpreted on the server before the document is sent to a requesting browser.
Prof. Nidal F. Shilbayeh 16

Chapter 1: Preliminaries

Programming Domains: Special Purpose Languages

The simulation of discrete systems is done by modeling these systems with a series of state changes. For example, in the simulation of a soda machine system, the state of the system can be the amount of coins received so far and the types of soda cans remaining with their quantities. A simulation technique follows the system elements through their change of state and gathering quantitative or factual information. This information is then used to predict the properties of the system under hypothetical situations.
Prof. Nidal F. Shilbayeh 17

Chapter 1: Preliminaries

Programming Domains: Special Purpose Languages

RPG (Report Program Generator): was introduced by IBM in the 1960s for the generation of reports. It has a fixed coding structure with formats for:

input specification (files and data) switch specification (Boolean) calculation and process output specification Newer versions of RPG are effective alternatives to COBOL for a wide range of commercial work.
Prof. Nidal F. Shilbayeh 18

Chapter 1: Preliminaries

Programming Domains: Special Purpose Languages (Cont.)

GPSS (General -Purpose Simulation System) is a simulation language that provides the user with a set of different block types to represent the activities of the system being simulated. The line joining the blocks indicates the logical sequence in which the activities can be executed.

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

19

Programming Domains: Special Purpose Languages (Cont.)

SIMULA is a language for system description and simulation with the concept of class (now adapted and used in object-oriented languages such as Ada, C++, Smalltalk, . . . etc).

A system in this case is viewed as a collection of independent entities (objects) interacting with each other. For example, for the soda machine system, the entities could be the soda machine, the can container, and the users. Systems are simulated by examining the life cycles of the entities of the system.
Prof. Nidal F. Shilbayeh 20

Chapter 1: Preliminaries

Programming Domains: General Purpose Languages

A general-purpose language combines features from scientific applications and business applications domains. An example of a general purpose language is Ada.

Chapter 1: Preliminaries

Prof. Nidal F. Shilbayeh

21

You might also like