Transcript Chapter 1

Concepts of
Programming Languages
Chapter 1
Copyright © 1998 by Addison Wesley Longman, Inc.
1
Why study concepts of PLs?
•
•
•
•
•
•
To increase capacity to express programming concepts
To improve background for choosing appropriate languages
To increase ability to learn new languages
To better understand the significance of implementation
To increase ability to design new languages
Overall advancement of computing
Copyright © 1998 by Addison Wesley Longman, Inc.
2
Programming Domains
•
•
•
•
•
•
•
Scientific applications
Business applications
Artificial intelligence
Systems programming
Scripting languages
Special purpose languages
Others?
Copyright © 1998 by Addison Wesley Longman, Inc.
3
Language Evaluation Criteria
• Readability
– Overall simplicity
– Too many features is bad
» Multiplicity of features is bad
– Orthogonality
» Makes the language easy to learn and read
» Meaning is context independent
– Control statements
– Data type and structures
– Syntax considerations
Copyright © 1998 by Addison Wesley Longman, Inc.
4
Evaluation Criteria (continued)
• Writability
– Simplicity and orthogonality
– Support for abstraction
– Expressivity
• Reliability
– Type checking
– Exception handling
– Aliasing
– Readability and writability
Copyright © 1998 by Addison Wesley Longman, Inc.
5
Evaluation criteria (continued)
• Cost
– Programmer training
– Software creation
– Compilation
– Execution
– Compiler cost
– Poor reliability
– Maintenance
• Others
– Portability
– Generality
– Well-definedness
Copyright © 1998 by Addison Wesley Longman, Inc.
6
Primary influences on
language design
• Computer architecture
– We use imperative languages, at least in part, because we use
von Neumann machines
• Programming methodologies
– 1950s and early 1960s: Simple applications; worry about
machine efficiency
– Late 1960s: People efficiency became important; readability,
better control structures
– Late 1970s: Data abstraction
– Middle 1980s: Object-oriented programming
Copyright © 1998 by Addison Wesley Longman, Inc.
7
Language Categories
•
•
•
•
Imperative (or Procedural)
Functional
Logic
Object-oriented (closely related to Imperative)
Copyright © 1998 by Addison Wesley Longman, Inc.
8
Language Design Trade-offs
• Reliability versus cost of execution
• Writability versus readability
• Flexibility versus safety
Copyright © 1998 by Addison Wesley Longman, Inc.
9
Implementation Methods
• Compilation
– Translate high-level program to machine code
– Slow translation
– Fast execution
• Pure interpretation
– No translation
– Slow execution
– Becoming rare
• Hybrid implementation systems
– Small translation cost
– Medium execution speed
Copyright © 1998 by Addison Wesley Longman, Inc.
10
Programming Environments
• The collection of tools used in software development
• UNIX
– An old operating system and tool collection
• Microsoft Visual C++
– A large, complex visual environment
• Smalltalk
– A language processor/environment
Copyright © 1998 by Addison Wesley Longman, Inc.
11