1/72
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Programming language
A notation for communicating to a computer what we want it to do.
“Hardwired” Programs
Pre-1940s computers required you to adjust the internal wiring to perform different tasks.
Assembly language
A set of mnemonic symbols for instruction codes and memory locations.
Assembler
A program that translates the symbolic assembly language code to binary machine code.
Loader
A program that loads the machine code into computer memory.
Mnemonic symbols shortcomings
Lacks abstraction of conventional mathematical notation
Each type of computer hardware architecture has its own machine language instruction set and requires its own dialect of assembly language
FORTRAN (FORmula TRANslation Language)
Developed by Backus in early 1950s
Reflected the architecture of a particular type of machine
Lacked the structured control statements and data structures of later high-level languages
Supported algebraic notation and floating point numbers
ALGOL (ALGOrithmic Language)
Released in 1960
First language that was machine independent
First language to receive a formal specification or definition
Supported different numeric types and control statements
Introduced arrays
Supported procedures and recursive procedures
Compiler
Translates programming language statements into machine code.
Pascal
Language for teaching programming in the 1970s.
Ada
Language for embedded applications of U.S. Dept. of Defense.
Lambda Calculus
Computational model developed by mathematician Alonzo Church which is based on the theory of recursive functions
Lisp
Programming language that uses the functional model of computation
Data abstractions
Simplify the behavior and attributes of data for humans
Ex. numbers, character strings, search trees
Control abstractions
Simplify properties of the transfer of control
Ex. loops, conditional statements, procedure calls
Basic abstractions
Collect the most localized machine information
Structured abstractions
Collect intermediate information about the structure of a program
Unit abstractions
Collect large-scale information in a program
Often associated with the concept of an abstract data type
Information hiding: Defining new data types (data and operations) that hide information
Separates the interface (available operations) from the implementation
Provides reusability
Application programming interface (API) gives information about the resource’s components
Basic data abstraction
Hides internal representation of common data values
Variables: use of symbolic names to hide computer memory locations
Data types: names given to kinds of data values
Declaration: process of giving a variable a name and data type
Data structure
Collects related data values into a single unit
Constructed from parts which can be hidden, accessed, or modified
Basic control abstractions
Statements that combine a few machine instructions into an abstract statement that is easier to understand.
Syntactic sugar
A mechanism that allows you to replace a complex notation with a simpler, shorthand notation.
Iterator
An object associated with a collection (such as array, list, set, or tree)
Procedure/subprogram/subroutine
Groups a sequence of actions into a single action that can be called or invoked from other points in the program
Does not return anything
Function
Mathematical and returns one thing
Method
The message sent to an object to make it do something
Runtime environment
The system implementation of the program
Higher-order functions
Functions that can accept other functions as arguments and return functions as values.
Unit
A stand-alone collection of procedures providing logically related services to other parts of a program.
Ex. Threads, processes, tasks
von Neumann bottleneck
Requirement that a program be described as a sequence of instructions.
Imperative language
Three properties
Sequential execution of instructions
Use of variables representing memory locations
Use of assignment to change the values of variables
Language syntax
Similar to the grammar of a natural language.
Language semantics
Meaning of a language
No generally accepted formal method for describing semantics
A language is successful if
It achieves the goals of its designers
It attains widespread use in an application area
It serves as a model for other languages that are successful
Writability
The quality of a language that enables a programmer to use it to express computation clearly, correctly, concisely, and quickly
Regularity
Refers to how well the features of a language are integrated.
Should minimize restrictions and strange interactions between constants.
Principle of least astonishment.
A language designed with security in mind…
Discourages programming errors
Allows errors to be discovered and reported
Semantically safe
Languages that prevent a programmer from compiling or executing any statements or expressions that violate the language definition.
Extensible language
A language that allows the user to add features to it.
Ex. New data types or operations
Macro
Specifies the syntax of a piece of code that expands to other standard code when compiled.
Variables in functional programming
Bound to values not memory locations.
Its value cannot change, eliminating assignment as an available operation.
Referential transparency
The property whereby a function’s value depends only on the values of its arguments (and nonlocal variables)
Value semantics
Semantics in which names are associated only to values, not memory locations
In functional programming, functions are…
First-class data values
They can be computed by other functions and parameters to other functions
LISP (LISt Processing)
First language that contained many of the features of modern functional languages
Tail recursive
When the recursive steps are the last steps in any function
Garbage collection
Automatic memory management technique to return memory used by functions
Higher-order functions
Functions that take other functions as parameters and functions that return functions as values
Static/lexical scope
The area of a program in which a variable declaration is visible
Free variable
A variable referenced within a function that is not also a formal parameter to that function and is not bound within a nested function
Bound variable
A variable within a function that is also a formal parameter to that function
Metalinguistic power
The capacity to build, manipulate, and transform lists of symbols that are then evaluated as programs
Currying
A process in which a function of multiple parameters is viewed as a higher-order function of a single parameter that returns a function of the remaining parameters.
Nonstrict
A property of a function in which delayed evaluation leads to a well-defined result, even though subexpressions or parameters may be undefined.
Lazy evaluation
Only evaluate an expression once it is actually needed
Generator-filter programming
A style of functional programming in which computation is separated into procedures that generate streams and other procedures that take streams as arguments
First-order predicate calculus
A way of formally expressing logical statements
Logic programming
A collection of statements is assumed to be axioms, and from them a desired fact is derived by the application of inference rules in some automated way.
Assembly language
A set of mnemonic symbols for instruction codes and memory locations
Structured control abstractions
Divide a program into groups of instructions nested within tests that govern their execution.
Branch instructions
Instructions that support selection and iteration to memory locations other than the next one.
Recursion
A mechanism that further exploits the abstraction mechanism.
Translator
A program that accepts other programs and either directly executes them or transforms them into a form suitable for execution.
Interpreter
A type of translator that executes a program directly.
Operates in one step, directly accepting input and source code.
Compiler
A type of translator that produces an equivalent program in a form suitable for execution.
Operates in two steps, taking a source program as input and outputting a target program.
Target may need to be translated by an assembler into an object program, then linked and loaded.
Efficiency considerations in a language
Execution
Target code
Programmer ability to read and write
Expressiveness for complex processes
Generality
A concept of regularity which is achieved by avoiding special cases in the availability or use of constructs and by combining closely related constructs into a single more general one.
Ex. In C can’t compare two structures with ==
Orthogonal design
A concept of regularity where constructs can be combined in any meaningful way with no unexpected restrictions or behaviors.
Ex. Pascal only allows scalar or pointer types to be returned.
Uniformity
A concept of regularity which implies a design in which similar things look similar and have similar meanings while different things look different.
Ex. C++ requires extra semicolon after a class definition but not function definition.
Functional programming
Provides a uniform view of programs as functions
Treats functions as data
Provides prevention of side effects
Function
A rule that associates to each x from set X of values a unique y from set Y of values.
Composition
A function takes two functions as parameters and produces another function as its returned value.