Reasons for Studying Concepts of Programming LanguagesIncreased capacity to express ideas增強表達想法的能力
Improved background for choosing appropriate languages改善背景知識來選擇適當的語言
Increased ability to learn new languages增強學習新語言的能力
Better understanding of significance of implementation更了解實做的重要性
Overall advancement of computing整體提高使用電腦
Reasons for studying concepts of programming languages學習程式語言觀念的理由
Programming domains程式領域
Language evaluation criteria語言評估準則
Influences on language design影響語言設計
Topics
Language categories語言類型
Language design trade-offs語言設計權衡
Implementation methods實做方法
Programming environments編輯程式環境
Reasons for Studying Concepts of Programming Languages
Increased capacity to express ideas增強表達想法的能力
Improved background for choosing appropriate languages改善背景知識來選擇適當的語言
Increased ability to learn new languages增強學習新語言的能力
Better understanding of significance of implementation更了解實做的重要性
Overall advancement of computing整體提高使用電腦
Programming Domains
Scientific applications科學上的應用
Large number of floating point computations
Fortran
Business applications商業上的應用
Produce reports, use decimal numbers and characters
COBOL
Artificial intelligence (AI)人工智慧
Symbols rather than numbers manipulated
LISP
Programming Domains
Systems programming系統程式
Need efficiency because of continuous use
C
Web software網頁軟體
Eclectic collection of languages
markup (e.g., XHTML), scripting (e.g., PHP), general-purpose (e.g., Java)
Language Evaluation Criteria
Readability (可讀性)
The ease with which programs can be read and understood
Writability (可寫性)
The ease with which a language can be used to create programs
Reliability (可靠性)
Conformance to specifications (i.e., performs to its specifications)
Cost (代價)
The ultimate total cost
Evaluation Criteria: Readability
Overall simplicity (全部簡明易懂)
A manageable (易辨的) set of features and constructs
Few feature multiplicity (多樣性) (means of doing the same operation)
Minimal operator overloading
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
Every possible combination is legal
Control statements (控制陳述)
The presence (存在) of well-known control structures (e.g., while statement)
Evaluation Criteria: Readability
Data types and structures (資料型態與結構)
The presence of adequate facilities for defining data structures
Syntax considerations (語法考慮)
Identifier forms (識別符形式)
Flexible composition (彈性寫作)
Special words
Methods of forming (形成) compound statements
Form and meaning
Self-descriptive constructs, meaningful keywords
Evaluation Criteria: Writability
Simplicity and orthogonality (簡單與正交性)
Few constructs, a small number of primitives, a small set of rules for combining them
Support for abstraction (支援抽象)
The ability to define and use complex (混合) structures or operations in ways that allow details to be ignored
Expressivity (表達性)
A set of relatively (相對) convenient (便利) ways of specifying operations
Example
The inclusion of for statement in many modern languages
Evaluation Criteria: Reliability
Type checking (型態確認)
Testing for type errors
Exception handling (例外處理)
Intercept run-time errors and take corrective measures
Aliasing (別名)
Presence of two or more distinct (截然不同的) referencing methods for the same memory location
Readability and writability (可讀性與可寫性)
A language that does not support “natural” ways of expressing an algorithm will necessarily use “unnatural” approaches, and hence reduced reliability
Evaluation Criteria: Cost
Training programmers to use language
Writing programs (closeness to particular applications)
Compiling programs
Executing programs
Language implementation system
Availability (可得性) of free compilers
Reliability
Poor reliability leads to high costs
Maintaining programs
Evaluation Criteria: Others
Portability (可攜)
The ease with which programs can be moved from one implementation to another
Generality (普遍性)
The applicability to a wide range of applications
Well-definedness (良好定義的特性)
The completeness (完整特性) and precision (精確) of the language’s official definition
Influences on Language Design
Computer Architecture (電腦架構)
Languages are developed around the prevalent computer architecture, known as the von Neumann architecture
Programming Methodologies (編譯程式方法論)
New software development methodologies (e.g., object-oriented software development) led to new programming paradigms (模範) and by extension (擴展) new programming languages
Computer Architecture Influence
Well-known computer architecture
Von Neumann
Imperative languages (命令式語言), most dominant (優勢), because of von Neumann computers
Data and programs stored in memory
Memory is separate (分離) from CPU
Instructions and data are piped from memory to CPU
Basis for imperative languages
Variables model memory cells
Assignment statements model piping
Iteration (重複) is efficient
The von Neumann Architecture
Programming Methodologies Influences
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
Programming Methodologies Influences
Late 1970s
Process-oriented to data-oriented
Data abstraction
Middle 1980s
Object-oriented programming
Data abstraction (抽象) + inheritance (繼承) + polymorphism (多形)
Language Categories
Imperative (命令式)
Central features are variables (變數), assignment statements (敘述), and iteration (反覆)
Examples: C, Pascal
Functional (函數式)
Main means of making computations is by applying functions to given parameters
Examples: LISP, Scheme
Logic (邏輯)
Rule-based (rules are specified in no particular order)
Example: Prolog
Language Categories
Object-oriented (物件導向)
Data abstraction, inheritance, late binding
Examples: Java, C++
Markup (標記)
New; not a programming per se, but used to specify the layout of information in Web documents
Examples: XHTML, XML
Comments