Lecture 02 Flashcards

(24 cards)

1
Q

Algol

A

Algol (ALGOrithmic Language),
designed to overcome
the problems of FORTRAN in the late 50s.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Algol 60 Major Concepts

A
  • use of formal notation for syntax (BNF notation - lecture 5);

– block structure (with locally-defined variables);

– recursive procedures; and

– “readable” if and for statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Pascal

A

It is a direct descendant of Algol, intended to be more
efficient in order to compete with Fortran as a general purpose language.

Pascal compiler was designed to be portable, by compiling to a virtual machine (the p-code system).

Pascal became popular in the late 70s as a teaching
language in universities

More recent versions of Pascal have added modules and classes (e.g., the Object Pascal language, also called
Delphi)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Pascal continued

A

The program statement is a required first line of every program.

Program must have a name.

  • input means that the keyboard may be used to put information into the program.

– output means that the program may write information to the video display.

program must have a “begin” to mark, likewise with an “end” statement too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

C

A

Fortran and COBOL proved successful in the 60s.

C was developed in 1972, alongside UNIX OS at Bell Labs.

C has high-level features like functions, loops and has low-level operations like arithmetic on memory addresses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Object Oriented Language

A

Major application of computers is simulation of real-world systems.

Early programming languages developed for simulation include GPSS (1961) and Simula 1 (1965).

Designers of Simula, Dahl, Nygaard added the concept of the “class” to represent simulated entitites.

Simula 67 is considered as orginial object oreintated language.

Influential object-orientated languages that followed Simula 67 include Smalltalk (1980) and Eiffel (1986).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Scripting Languages

A

They are used to write programs that run for a special run-time environment that automate execution of tasks, or alternatively be executed by one-by-one by a human operator. For example shell scripts (CLI).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Scripting Languages Examples

A

High Level languages such as Perl, Python, Ruby, PHP, JavaScript, and MatLab.

Scripting languages have a simple syntax and semantics, interpreted and intended to be very fast to learn and write in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Logical Languages: Prolog

A

ProLog building blocks are variables, constants, and structures.

Variables begin with capital letter.

Constants are either atoms like words or integers.

Structures consist of functor and arguments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Prolog Queries

A

Used to answer queries ( arithmetic operations possible)

Query is a fact or rule that initiates a search for success in Prolog program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Language Evaluation Criteria

A

Simplicity
Lexical elements.
Orthogonality
Control Structures
Data Types
Expressiveness
Type Checking
Exception Handling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Simplicity

A

Language with simple syntax and small number of constructs. Smalltalk is considered simple vs C++ which is complex/large.

Programmers tend to learn only a subset of large language.

An example is i++, i = i + 1 in C++ and Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Lexical Elements

A

Form of individual lexical elements (words, symbols) of language that can affect readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Lexical Elements in Fortran 77

A

Fortran 77, variable names of 6 characters, making use of informative names difficult.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Lexical Elements
meaning

A

In Java, the meanings of keywords class and if are obvious. The meaning of static is not.

This means that the symbol = (used in Pascal) is more easily recognised as equal term == in (C, C++, Java).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Orthogonality meaning

A

Relatively small number of control and data constructs. ( e.g. data types)

Combined in a relatively small number of ways.

Every possible combination is legal and meaningful.

Programmer not needed to remember a lot of special cases, with orthogonal language in its constructs.

17
Q

Orthogonality example

A

Data Types in a procedural language:

  • Several elementary data types (e.g int, double)
  • Several ways to combine data types ( sets, arrays, records and pointers) in order to define compound data types.
18
Q

Example of Non-Orthogonality in Paschal

A
  • A set of char type is legal, but a set of integer data type is not permitted.
  • A data type is valid as the type of a parameter to a function/procedure
    (this is orthogonal); but arrays cannot be returned from functions
19
Q

Example of Non-Orthogonality in Java

A

Java has several kinds of types: classes, arrays &
primitive types.

-Can have classes/methods that operate for any
kind of objects, but not for primitive types (because
they are not objects).

20
Q

Impacts of Orthogonality

A

Influences both readability and writability of software.

If a language contains fewer special cases, it is easier to learn ( easier to read and write)

21
Q

Impacts of Orthogonality - Java statement

A

Java statements deal with adding and retrieving ints from a Vector:

vector data = new vector();
data.add(new Integer(e));
return ((Integer) data.lastElement()).intValue();

Conversion of primitive data to/from objects clearly illustrate poor readability and writability.

22
Q

Data Types

A

Rich enough set of data is important.

C ( until recently) included no Boolean type ( 0 was used for false and any nonzero integer for true)

It is clear which of the following are more readable:

finished = 1; finished = true;

23
Q

Data Types Mechanisms

A

Mechanisms for combining types are also important.

  • Fortran 77 doesn’t include a record mechanism, so to represent a
    collection of, say, bank accounts, one has to use separate arrays:

integer number (100)
character (len = 30) name (100)
real bal (100), odlim (100)

  • These arrays must be indexed separately (e.g., when sorting based
    on balances, swaps need to be performed on all of them).
24
Q

Expressiveness

A

Relates to how much code and effort is required to implement computations.

For example in Java, it is more convenient to write i++ than i = I + i

Versus even the TPK algorithm in C.

For this, Python is more expressiveness too.