Chapter 1: Introduction Flashcards
Why are there so many programming languages?
- Evolution: we find better ways of doing things over time
- Special purposes: for different problem domains (C for low-level, Prolog for logical relationships)
- Personal preference (some people like to think recursively, others iteratively; some like pointers, etc.)
- Proprietary interests (Java)
What makes a programming language successful?
[need to finish……]
•Expressive power: good abstraction facilities; ability to write clear & maintainable code (C, Common Lisp, Perl)
•Short learning curve (BASIC, Pascal, LOGO, Scheme)
•Easy to implement: portable (BASIC, Forth)
•Standardization
•possible to compile to very good (fast/small) code (Fortran)
•backing of a powerful sponsor (COBOL, PL/1, Ada, Visual Basic)
•wide dissemination at minimal cost (Pascal, Turing, Java)
Why do we have programming languages? Purpose?
- way of thinking – expressing algorithms
- languages from the user’s point of view
- abstraction of virtual machine – specifying what you want the hardware to do without getting down into the bits
- languages from the implementor’s point of view
Why study programming languages?
(1) To help you choose the appropriate tool for the job
•C vs. Modula-3 vs. C++ for systems programming
•Fortran vs. APL vs. Ada for numerical computations
•Ada vs. Modula-2 for embedded systems
•Common Lisp vs. Scheme vs. ML for symbolic data manipulation
•Java vs. C/CORBA for networked PC programs
(2) To make better use of whatever language you choose
•Understand obscure features
•In C, help you understand unions, arrays & pointers, separate compilation, varargs, catch and throw
•In Common Lisp, help you understand first-class functions/closures, streams, catch and throw, symbol internals
•Figure out how to bring in powerful concepts from other languages into your language
How are programming languages grouped?
Imperative & Declarative
What are examples of “Imperative” languages?
- von Neumann (Fortran, Pascal, Basic, C)
- object-oriented (Smalltalk, Eiffel, C++?)
- scripting languages (Perl, Python, JavaScript, PHP)
What are examples of “Declarative” languages?
- functional (Scheme, ML, Haskell)
* logic, constraint-based (Prolog,Make)
What is “Pure Compilation”?
- The compiler translates the high-level source program into an equivalent target program (typically in machine language), and then goes away
- Better performance
- Compilation is translation from one language into another, with full analysis of the meaning of the input
- Compilation entails semantic understanding of what is being processed; pre-processing does not
What is “Pure Interpretation”?
- Interpreter stays around for the execution of the program
- Interpreter controls the execution
- Greater flexibility
- Better diagnostics (error messages)
- Languages can have a mixture of compilation (JIT) and interpretation
What is the difference between machine language and assembly language?
[blank]
How are high-level languages an improvement on assembly language? When does it still make sense to program in assembler?
[blank]
Name 3 von Neumann languages.
[blank]
Name 3 functional languages.
[blank]
Name 3 object-oriented languages.
[blank]
Name 2 logic languages.
[blank]