Chapter 2
What language introduced the case statement?
ALGOL-W
What three concepts are the basis for object-oriented programming?
Data abstraction, inheritance, polymorphism
Fortran Evaluation
Highly optimizing compilers (all versions before 90) - Types and storage of all variables are fixed before run time
What hardware capability that first appeared in the IBM 704 computer strongly affected the evolution of programming languages? Explain why.
Indexing and floating-point instructions in hardware, this heralded the end of the interpretive era for scientific computation
From what language does Objective-C borrow its syntax for method calls?
Smalltalk
What is a nonprocedural language?
A nonprocedural program is one that uses logic notation
Why did Algol not succeed?
Although IBM was initially enthusiastic, all support was dropped by mid 1959 - Back then, adopting new programming languages was considered expensive • Persuading programmers to try something new • Getting a "useful" first-generation compiler - Compiler theory & tools were in their infancy at the time
What features of SIMULA 67 are now important parts of some object-oriented languages?
Class constructs, data abstraction
Algol 58
Concept of type was formalized • Names could be any length • Arrays could have any number of subscripts • Subscripts were placed in brackets • Parameters were separated by mode (in & out) • Compound statements (begin ... end) • Semicolon as a statement separator (not terminator) • Assignment operator was := • if had an else-if clause • No I/O - "would make it machine dependent"
ALGOL 68
From the continued development of ALGOL 60 but not a superset of that language > Design is based on the concept of orthogonality > A few basic concepts, plus a few combining mechanisms Major contribution was the concept of orthogonality
What characteristic does Ruby share with Smalltalk?
It is pure object-oriented
What is the relationship between JavaScript and PHP, in terms of their use?
JavaScript is client-side and PHP is server-side
Where was LISP developed? By whom?
John McCarthy and Marvin Minsky at MIT
What user group was the target of the first version of BASIC?
Liberal arts students
Why were linguists interested in artificial intelligence in the late 1950s?
Linguists were concerned with natural language processing
What is the primary application for Objective-C?
Mac OS X and iOS
PL/I Contributions
PL/I contributions - First unit-level concurrency - First exception handling - Switch-selectable recursion • Turn off recursion at compile time for faster execution - First pointer data type - First array cross sections
An assignment statement to assign the expression A[4] + 1 to A[5] | A + 1 => A V | 4 5 (array reference) S | 1.n 1.n (data types for variables in first line) 1.n: an integer of n bits V: label for subscripts, S: label for data types
Plankalkül Syntax
What was wrong with using machine code?
Poor readability Instruction may refer to other location Poor modifiability (Inserting or deleting instruction invalidates correctness of all instructions) Expression coding was tedious Machine deficiencies--no floating point
What array structure is included in C# but not in C, C++, or Java?
Rectangular arrays
What was the primary application area of computers at the time Fortran was designed?
Scientific computations
What deficiency of the switch statement of C is addressed with the changes made by C# to that statement?
The complex structure
Fortran 95
minor addition
Fortran 99
• Most significant changes from Fortran 77 - Free formatting of code - Modules - Array subsection references - Dynamic arrays - Pointers (a very restricted form) - Recursion - CASE statement - Parameter type checking
Fortran II
- Independent compilation - Fixed the bugs
Fortran 2003
- support for OOP, procedure pointers, interoperability with C
What are the goals of Algol?
1. Close to mathematical notation 2. Good for describing algorithms 3. Must be translatable to machine code
Where are servlets executed?
A Web server
Why was Algol developed?
ALGOL was the result of efforts to design a universal language - for communicating algorithms
What language was designed to describe the syntax of ALGOL 60?
BNF
Algol 60
Block structure (local scope) - Two parameter passing methods • Pass-by-value and pass-by-name - Subprogram recursion • New for imperative languages (already available in LISP) - Stack-dynamic arrays - Still no I/O and no string handling
Chapter 2 Summary
Considered the development, developmental environment, and evaluation of a number of important programming languages • Hopefully it has given you some perspective into current issues in language design
What were Algol 68's contributions?
Contributions: - Concept of orthogonality - User-defined data structures - Reference types - Dynamic arrays (called flex arrays)
Pascal
Designed for teaching structured programming - It was both simple and expressive - Relatively "safe" compared to Fortran & C Small, simple, nothing really new
Pseudocodes
Different meaning than contemporary meaning In 1940s: computers were slow, unreliable, expensive, small memory; no high-level prog. Language, even assembly; Programing was in machine code (numeric code for instructions)
How does the typing system of PHP and JavaScript differ from that of Java?
Dynamic typing
Fortran IV
Evolved during 1960-62 - Explicit type declarations - Logical IF statement - Subprogram names could be parameters - ANSI standard in 1966
What were Algol 60's failures? What were the reasons for its failure?
Failure - Never widely used, especially in U.S. Reasons: 1. Lack of I/O and the character set made programs nonportable 2. Too flexible -- hard to implement - Few compilers implemented the entire language 3. Entrenchment of Fortran 4. Formal syntax description (BNF) seemed too complex 5. Lack of support from IBM
Speedcoding was invented to overcome two significant shortcomings of the computer hardware of the early 1950s. What were they?
Floating point numbers and incremented address registers
What is Fortran and why was it invented?
Fortran was designed for the IBM 704 which had (1) index registers and (2) floating point hardware and was used mainly for scientific computations. There was no place to hide the costs of compilation, so this led to the idea of compiled languages. In addition, the computers had small memories and were unreliable, applications were mainly scientific in nature, and there weren't any programming methodologies or tools to speak of. So naturally, machine efficiency was the primary concern.
Why does C++ include the features of C that are known to be unsafe?
Most C programs are backwards compatible with C++
Fortran 1
Names could have up to six characters - Post-test counting loop (DO) - Formatted I/O - User-defined subprograms - Three-way selection statement (arithmetic IF) - No data typing statements No separate compilation Code was very fast Quickly became widely used
Design Process of Fortran
Need good array handling and counting loops - No need for dynamic storage - No string handling, decimal arithmetic, or powerful input/output (as needed for business software)
What are two characteristics of C that make it less safe than Pascal?
No type checking and all data is considered machine words
What populates the Smalltalk world?
Objects
What innovation of data structuring was introduced in ALGOL 68 but is often credited to Pascal?
Orthogonality
PL/I
Scientific users began to need more elaborate I/O, like COBOL had; business users began to need floating point and arrays for MIS It looked like many shops would begin to need two kinds of computers, languages, and support staff--too costly The obvious solution: - Build a new computer to do both kinds of applications (System 360 architecture) - Design a new language to do both kinds of applications (plus systems programming) PL/I was created to be a universal language for scientific/business applications and would have: floating point numbers, arrays, I/O.
What are Algol 60's successes?
Successes - It was the standard way to publish algorithms for over 20 years* - All subsequent imperative languages are based on it - First machine-independent language - First language whose syntax was formally defined (using BNF)
Why was the slowness of interpretation of programs acceptable in the early 1950s?
The lack of floating-point hardware in the available computers
What missing language element of ALGOL 60 damaged its chances for widespread use?
The lack of input and output statements
For what application area is JavaScript most widely used?
Web browsers
Zuse's Plankalkül
Wrote many algorithms; Never implemented Had advanced data type and data structures -Single bit; integer, and floating point data types ( built from bit type) -arrays, records, and nested records No explicit go to; did include iterative and selection statements; didn't allow else clause Mathematical expression showing current relationship btw variables (expression stated what would be true during execution , like assertion in java) Each statement has 2 or 3 lines of code
Fortran 2008
blocks for local scopes, co-arrays, Do Concurrent
Fortran 77
• Became the new standard in 1978 - Character string handling - Logical loop control statement - IF-THEN-ELSE statement
