Chapter 1

Chapter 1
CSCE 343
Homework #1
Groups: Language // Lab Time??
•
•
•
•
•
•
Bradley and Konark : Python
James, DK, Patrick : C, C++
JD and Denise: Algol
Krystal and Vickie: Perl
John and Lexie: Prolog
Peter and Fredrik : Scheme
Why study programming languages?
Author’s reasons
– Increased capacity to express ideas
• You are limited by the constructs of the languages
you know
– Improve background for choosing appropriate
language
• Programming language fit the particular problem
– Increase ability to learn a new language
Author’s reasons
– Understand significance of implementation
• Help to write more efficient code (passing args)
• Help in debugging code (C arrays)
– Better understanding of languages you
already know
• Recursion, buffers, circular arrays
– Overall advancement of computing
• Determine if a language is “good” not just popular
Programming Domains
• Scientific Application
– Fortan / ALGOL 60
• floating pt, arrays, number crunching, loops
(imperative languages)
• Business Applications
– COBOL ISO/IEC
• report generation, formatting, storing data (decimal
numbers and strings)
• Artificial Intelligence
– LISP Scheme Prolog (functional or logical
programming language)
• Symbol manipulation, lists
Programming Domains
• System Programming
– work with OS system software (file server)
– efficient low level hardware access and
control
– (PL/I,IBM), (C, Unix), (ALGOL,Burroughs)
• Web Programming
– XHTML / Java / Java Servlets and JSP
– scripting languages (java script, php)
What makes a good programming language?
• On a piece of paper, without looking in the
textbook, write down at least two criteria
for evaluating programming languages.
• Now, compare your reasons with your
neighbor’s. Are they the same or
different?
• What did you come up with? (Write on the
board)
Evaluating Languages
• Readability
– make maintenance easy
• Writability
– makes programming easy
• Reliability
– make debugging easy
– type checking, exception handling, aliasing
• Cost
– make paying for everything easy
– training, writing code, maintaining code, compiling
and running
Pratt / Zelkowitz List
•
•
•
•
•
•
•
•
clarity (simplicity, unity)
orthogonality
naturalness for application
support for abstraction
ease of verification
environment
portability
cost
Trade Offs
•
•
•
•
Reliability vs Cost of execution
Readability vs. Writability
Flexibility vs. Safety
More features (writability)
– Harder to learn (cost)
– Harder to read (readability)
• Strong type checking (reliable)
– Less flexible (writablity)
– Slower compile time (cost)
Von Neumann Architecture
Von Neumann Execution Cycle
initialize the program counter
repeat forever
fetch the instruction pointed by
the counter
increment the counter
decode the instruction
execute the instruction
end repeat
 Imperative Language
Influences on Language Design
• Architecture: Von Neumann (imperative lang)
• Programming Methodologies
– 1950s-1960s: Simple applications – main worry was
efficiency
• Deficiencies: Incompleteness of type checking, use of goto’s
– Late 1960s: People efficiency, readability, better control
structures:
• Looping constructs, code blocks (functions, procedures)
• Structured programming
– Top-down and step-wise refinement
– Late 1970s: Process-oriented to data-oriented
• Data abstraction (ADTs)
– But no way to enforce rules for access to data
– Middle 1980s: Object oriented programming
Language Categories
• Imperative
– Centeral features: variables, assignment,
iteration.
– C, Pascal
• Functional
– Main means of computation: applying
functions (no assignment)
– LISP, Scheme
Language Categories
• Logic
– Rule-based
– Rules in no special order (order is not important)
– Prolog
• Object oriented
–
–
–
–
Encapsulation (data and process)
Inheritance, dynamic type binding
Grew out of imperative languages
C++, Java, Smalltalk