424 Chapter 1 & 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

business applications

produce reports, use decimal numbers and characters COBOL

writability

the ease with which a language can be used to create programs

readability

the ease with which programs can be read and understood

Programming methodologies influence

1950s and early 1960s: Simple applications; worry about machine efficiency Late 1960s: People efficiency became important; readability, better control structures - structured programming - top-down design and step-wise refinement Late 1970s: Process-oriented to data-oriented - Abstract data types to model program domain Middle 1980s: Object-oriented programming - Data abstraction + inheritance + polymorphism

Hybrid Implementation Systems

A compromise between compilers and pure interpreters Use: Small and medium systems when efficiency is not the first concern

Hybrid Implementation Systems

A compromise between compilers and pure interpreters a high-level language program is translated to an intermediate language that allows easy interpretation faster than pure interpretation examples: - Perl programs are partially compiled to detect errors before interpretation - initial implementations of Java were hybrid; the intermediate form, byte code, provides portability to any machine that has a byte code interpreter and a run-time system (together, these are called Java Virtual Machine)

Concept of type was formalized names could be any length arrays could have any number of subsripts Parameters were separated by mode (in & out) Subscripts were placed in brackets Compound statements (begin ... end) Semicolon as a statement separator Assignment operator was := if had an else-if clause No I/O - "would make it machine dependent"

ALGOL 58

Algol 58 Intended to outline a universal programming language - Not meant to be implemented but variations of it were (MAD, JOVIAL) Algol 60 was discussed and defined early in 1960; New Features - Block structure (local scope) - Two parameter passing methods - Subprogram recursion - Stack-dynamic arrays - Still no I/O and no string handling

ALGOL 58/60

Successes - 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 (BNF) Failures: Never widely used, especially in U.S. because - Lack of I/O and the character set made programs non-portable - Too flexible--hard to implement - Entrenchment of Fortran - Formal syntax description - Lack of support from IBM

ALGOL 60 Evaluation

- APL's large set of operators leads to short programs, but operators are symbolic & mostly have no obvious semantic meaning - Writable in the sense that complex operations can be specified by a single operator - Readable only if you understand it well;

APL

Designed as a hardware description language at IBM by Ken Iverson around 1960 - Highly expressive (many operators, for both scalars and arrays of various dimensions) - Programs are very difficult to read Still in use; minimal changes

APL: A programming language

Contributions - Packages - support for data abstraction - Exception handling - elaborate - Generic program units - Concurrency - through the tasking model Comments - Competitive design - Included all that was then known about software engineering and language design - First compilers were very difficult; the first really usable compiler came nearly five years after the language design was completed

Ada Evaluation

FORTRAN II: Distributed in 1958 - Independent compilation - Fixed the bugs FORTRAN IV: Evolved during 1960-62 - Explicit type declarations - Logical selection statement - ANSI standard in 1966 FORTRAN 77: Became the new standard in 1978 - Character string handling - Logical loop control statement (do-loop strictly counting) using the IF-THEN-ELSE statement FORTRAN 77: probably the most popular version of the language; it faced competition from C, Pascal, Algol, and other, leading to Fortran 90

All the FORTRANS

Developed at Sun in the early 1990s - C and C++ were not satisfactory for embedded electronic devices Based on C++ - Significantly simplified (does not include struct, union, pointer arithmetic, and half of the assignment coercions of C++) - Supports only OOP - Has references, but not pointers - Includes support for applets and a form of concurrency

An Imperative-Based Object-Oriented Language: Java

Designed for systems programming (at Bell Labs by Dennis Richie) Evolved primarily from BCLP and B, but also ALGOL 68 Powerful set of operators, but poor type checking Initially spread through UNIX Though designed as a systems language, it has been used in many application areas

C - 1972

Based primarily on FLOW-MATIC: Grace Hopper - Math programs should use math notation, data processing programs should be written in English Design goals; it must - look like simple English - be easy to use, even if that means it will be less powerful - broaden the base of computer users - not be biased by current compiler problems Very wordy - long programs

COBOL

Contributions - First macro facility in a high-level language - Hierarchical data structures (records) - Nested selection statements - Long names (up to 30 characters), with hyphens - Separate data division First language required by DoD Still most widely used business applications language, probably due to legacy code - Could be replaced by ERP (Enterprise Resource Planning) systems: a collection of applications that can use a single database containing all company data

COBOL Evaluation

Developed at Bell Labs by Stroustrup in 1980 Evolved from C and SIMULA 67 Facilities for object-oriented programming, taken partially from SIMULA 67 A large and complex language, in part because it supports both procedural and OO programming Rapidly grew in popularity, along with OOP ANSI standard approved in November 1997 Microsoft's version: MC++ - properties, delegates, interfaces, no multiple inheritance

Combining Imperative and Object Oriented Programming: C++

Von Neumann Bottleneck

Connection speed (memory access time) between a computer's memory and the processor determines the speed of a computer Program instructions can be executed much faster than the speed of the connection; the connection speed thus results in a bottleneck it is a primary limiting factor in the speed of computers Cache memory was invented to help lessen the effect of the bottleneck

Web Software

Eclectic collection of languages: markup (e.g., HTML), scripting (e.g., PHP), general-purpose (e.g., Java)

Designed by IBM and SHARE Computing situation in 1964 (IBM's point of view) - Scientific computing -IBM 1620 and 7090 computers -FORTRAN -SHARE user group - Business computing -IBM 1401, 7080 computers -COBOL -GUIDE user group

Everything for Everybody: PL/I

Data and programs stored in memory Memory is separate from CPU Instructions are transferred from memory to CPU Data is moved from memory to the CPU for processing and back to memory for storage

Features of the Von Neumann Architecture

initialize the program counter repeat forever fetch the instruction pointed to by the counter increment the counter decode the instruction execute the instruction end repeat operates on machine language instructions assembly language is basically machine language with symbolic, rather than numeric, codes + a few additional features early languages added another layer of abstraction onto assembly language, resulting in a language that closely resembles the architecture of the underlying hardware

Fetch-execute cycle on a Von Neumann architecture computer

First implement version of FORTRAN Names could have up to six characters Post-test counting loop (DO) Three-way selection state (arithmetic IF) IF x S1, S2, S3 means if (x < 0) statement 1 elif (x == 0) statement 2 elif statement 3 formatted I/O User-defined subprograms No data typing statements - data type indicated by first letter of variable name code was very fast (relative to pseudo code) quickly became widely used Early FORTRAN only implement static memory control structures (loops, selection statements) were all based on the 704's instruction set

Fortran 1 Overview

Huge design effort, involving hundreds of people, much money, and about eight years Sequence of requirements (1975-1978) - (Strawman, Woodman, Tinman, Ironman, Steelman) Named Ada after Augusta Ada Byron, the first programmer

History's Largest Design Effort: Ada

Portability

Is the language standardized? Can I execute my program on another computer with a different compiler? In other words, is there a standard version of the language?

Well-definedness

Is there a complete, precise, easy-to-understand definition of the language?

Pure functional programming - Doesn't need variables or assignments - Control via recursion and conditional expressions Still the dominant language for AI Common Lisp, Scheme were contemporary dialects of Lisp ML, Haskell, and F# are also functional programming languages, but use very different syntax

LISP Evaluation

LISP

LISt Processing - designed at MIT by John McCarthy AI research needed a language to - process data in lists (rather than arrays) - symbolic computation (rather than numeric) - only two data types: atoms and lists - syntax is based on the lambda calculus

Reliability vs. cost of execution - Example: Java demands all references to array elements be checked for proper indexing, which leads to increased execution costs Readability vs. writability - Example: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readability Writability (flexibility) vs. reliability - Example: C++ pointers are powerful and very flexible but are unreliable

Language Design Trade-offs

Fortran 90 changes from FORTRAN 77

Modules Dynamic arrays Pointers Recursion CASE statement Parameter type checking Later versions made minor changes Support for OOP Extremely efficient until dynamic storage, recursion were introduced

Systems Programming

Need efficiency because of continuous use C

Developed at Xerox PARC, initially by Alan Kay, later by Adele Goldberg Developed during 70's, released as Smalltalk 80. First full implementation of an object-oriented language (data abstraction, inheritance, and dynamic binding) Pioneered the graphical user interface Promoted OOP

Object-Oriented Programming: Smalltalk

Developed by Wirth (a former member of the ALGOL 68 committee) Designed for teaching structured programming Small, simple, nothing really new Largest impact was on teaching - From mid-1970s until the late 1990s, it was the most widely used language for teaching programming

Pascal - 1971

Developed, by Comerauer and Roussel (University of Aix-Marseille), with help from Kowalski ( University of Edinburgh) Based on formal logic Non-procedural Can be summarized as being an intelligent database system that uses an inferencing process to infer the truth of given queries Comparatively inefficient Few application areas

Programming Based on Logic: Prolog

number of language constructs/features - too many: confusing - too few: may need to combine several features to accomplish something that logically could be considered a single feature feature multiplicity: several ways to do something - unnecessarily complicated or confusing minimal operator overloading - can simplify code & improve readability if used judiciously (for example, arithmetic operators) but can have a negative effect if user-defined overloading is used carelessly

Readability simplicity Factors

structured types

Strings, lists, arrays, hash tables

Designed primarily for system simulation in Norway by Nygaard and Dahl Based on ALGOL 60 and SIMULA I Primary Contributions - Coroutines - a kind of subprogram - Classes, objects, and inheritance

The Beginning of Data Abstraction: SIMULA 67

Designed by Kemeny & Kurtz at Dartmouth Design Goals: - Easy to learn and use for non-science students - Must be "pleasant and friendly" - Fast turnaround for homework - Free and private access - User time is more important than computer time Current popular dialect: Visual Basic First widely used language with time sharing

The Beginning of Timesharing: Basic

Part of the .NET development platform (2000) Based on C++ , Java, and Delphi Includes pointers, delegates, properties, enumeration types, a limited kind of dynamic typing, and anonymous types

The Flagship .NET Language: C#

Generality

The applicability to a wide range of applications

programming environments

a collection of tools used in software development UNIX - An older operating system and tool collection - Nowadays often used through a GUI (e.g., CDE, KDE, or GNOME) that runs on top of UNIX Microsoft Visual Studio.NET - A large, complex visual environment - Used to build Web applications and non-Web applications in any .NET language NetBeans - Related to Visual Studio .NET, except for applications in Java

type

a collection of values and a collection of operations on those values

programming paradigm

a pattern or framework for computer problem-solving

semantics

a program's meaning

orthogonality

a relatively small set of primitive constructs can be combined in a relatively small number of ways to build the control and data structures of the language (minimal feature multiplicity) - all combinations are legal; context doesn't affect meaning; in other words, _______ is weakened if there are exceptions (this is a readability factor)

examples of non-orthogonality

any language with pointers that allows pointers to point to some things but not others IBM mainframe assembly language integer add ops A function can return any type except an array type or a function type

type system

can help to determine legal operations and detect type errors

imperative languages

central features are variables, assignment statements, and iteration; based on von neumann architecture includes object-oriented, scripting, and visual languages examples: C, Java, perl, JavaScript, Visual BASIC .NET, C++ many PL resear

imperative, declarative

common paradigms can be grouped together according to whether they have _______ characteristics or ________ characteristics

reliability

conformance to specifications (i.e., performs to its specifications

Syntax

describes legal statements, programs & program units defines form, not meaning used by - programmers to write correct programs -translators to recognize correct programs

Fortan 1:1957

developed by a team led by John Backus generally credited as being the first compiled high-level language

floating-point, indexing

early computers lacked _________ hardware & ____________ operations - Pseudo codes simulated these featuers and were implemented by interpreters - very slow - No demand for faster translators until IBM introduce the IBM 704, which had both index registers and floating point hardware

features, simplicity

expressivity can be increased by adding more _______ , but often at the expense of _________ examples: - PL/1: all things to all people; designed by IBM; meant to be used for scientific/business/systems applications _ APL: a matrix processing language - its basic data structures are multi-dimension arrays; - contains many built-in operators that represent complex array operations - requires a special keyboard

Training programmers to use the language Writing programs - Languages that are designed for particular classes of applications have features that make them more writable for those applications Compiling programs: - compilers that do a lot of type checking and code optimization increase compilation time but decrease execution time Executing programs - Ex: run-time type checking improves reliability but adds to execution time cost Tradeoffs between compile-time & execution time features can be tricky Language implementation system: availability of free compilers, development environments, etc. reduce cost & contribute to language adoption Reliability: poor reliability leads to high costs - Costs due to errors induced by the program - Costs due to bug fixes Maintaining programs - Program errors, programs with poor readability/ writability add to maintenance costs

factors of cost

Type checking - Testing for type errors, either at compile time or run time - Ex: failure to be sure argument type matches formal parameter type Exception Handling - Intercept run-time errors and take corrective measures No Aliasing - Aliasing = Presence of two or more different names for the same memory location; e.g. two pointers pointing to same location Readability and Writability - Languages with poor readability are often hard to write correctly & can cause problems during the maintenance phase of software

factors of reliability

simplicity and orthogonality: important, within limits expressivity is also important - enough operators, language constructs, built-in functions, etc. to allow programmers to say what they need to say -enhanced by having operators that condense multiple low-level operations in a single operator; e.g., APL

factors of writability

declaritive languages

functional: computations primarily consist of applying functions to parameters examples: LISP, Scheme, ML, F#, ... logic or rule based: computations primarily consist of making inferences from a database of rules & facts example: Prolog

implementation

how language features are translated into executable code it influences design decisions & vice versa; understanding the issues helps programmers use the language better understanding it can help find bugs or can improve program efficiency

Just-in-Time Implementation Systems

initially translate programs to an intermediate language then compile various parts of the intermediate language into machine code when they are executed machine code is kept for subsequent execution JIT systems are widely used for java programs .NET languages are implement with a JIT system In essence, JIT systems are delayed compilers

Von Neumann Architecture

languages are developed around the prevalent computer architecture, known as the

paradigm

languages typcially identify primarily with one _______, but may have aspects of several

scientific applications

large numbers of floating point computations; use of arrays Fortran

scope, visibility, type, lifetime

named entities are bound in a running program to:

pure interpretation

no code module is generated: the interpreter examines a portion of code, and then executes it advantage: run-time errors can easily and immediately be displayed, but the program must be interpreted each time it's run - slower execution (10 to 100 times slower than compiled programs) - may require more space (tables + interpreter code) rare for traditional and general purpose high-level languages significant comeback with some Web scripting languages (e.g., JavaScript, PHP) as well as 'quick & dirty' languages such as Python and Perl

simple types

numbers, characters, boolean

Preprocessor

processes a program immediately before the program is compiled to expand embedded preprocessor macros ________ macros (instructions) are commonly used to specify that code from another file is to be included example: C/C++ preprocessor - expands #include, #define, and similar macros

Pure interpratation

programs are "interpreted"; i.e.; executed by another program (the interpreter) that simulates a computer whose machine language is the language being prcessed Use: small programs or when efficiency is not an issue

Compilation

programs are translated into executable machine code Use: large scientific or commercial applications; any program that runs repeatedly and cares about efficiency

external references

references to entities defined in other modules

functional languages

rely on the evaluation of mathematical functions instead of statements

Artificial Intelligence

symbols rather than numbers manipulated; use of linked lists LISP

ability to define meaningful variable names - early langauges limited length methods of forming compound statements- start & close with curly brace pairs (C family) or use of special key words such as end-if or end-for form (syntax) suggests meaning (semantics): you should be able to infer the semantics of a construct from its form and key words avoid using similar syntax for different purposes, or having a key word whose meaning is context-dependent - Ex: in C/C++ the key words static and const

syntax considerations

linking and loading

the process of collecting system program units and previously written user functions linking them to a user program - the linker finds & provides memory addresses of system and user-defined functions, thus connecting separate parts into a single unit

cost

the ultimate total cost

Load module (executable image)

the user and system code together

Compilation

translates high-level program (source language) into machine code (machine language) slow translation, fast execution once a program is compiled it can be executed over and over without being re-translated compilation process has several phases: - lexical analysis: converts characters in the source program into lexical units - syntax analysis: transforms lexical units into parse trees which represent the syntactic structure of program - Semantic analysis: generates intermediate code - Code generation: machine code is generated

imperative languages

variables model memory cells assignment statements model data movement iteration is efficient statements in these types of languages are commands -- do this, do that


Ensembles d'études connexes

⚡️science test retake questions ⚡️

View Set

12.1 Sampling Techniques and Misuses of Statistics

View Set

Ch. 27 Anxiety and other disorders

View Set

Chapter 3 The Chemistry of Water

View Set

Chapter 12 Lesson 4: The War Ends

View Set