330CSS-Lecture 01.ppt
330CSS-Lecture 01.ppt
Lecture 01
330 CSS-3 PROGRAMMING PARADIGMS
OBJECTIVE:
INTRODUCTION
Introducton to Computer Programming
Programming Languages
Programming Paradigms
Reasons for Studying Concepts of Programming Languages
Programming Domains
Language Evaluaton Criteria
Infuences on Language Design
1-3
Computer Programming
A computer program must be clear so that only one meaning can be derived
from it,
1. Machine languages.
2. Assembly languages.
3. High-level languages.
Disadvantages
Not portable
Not programmer friendly
Disadvantages
Not as efcient as low-level languages
Need to be translated
Examples : C, C++, Java, FORTRAN, Visual Basic, and Delphi.
1-11
Programming Domains
• Scientfc applicatons
• Large number of foatng point computatons
• Fortran
• Business applicatons
• Produce reports, use decimal numbers and characters
• COBOL
• Artfcial intelligence
• Symbols rather than numbers manipulated
• LISP
• Systems programming
• Need efciency because of contnuous use
• C
• Web Sofware
• Eclectc collecton of languages: markup (e.g., XHTML), scriptng (e.g., PHP),
general-purpose (e.g., Java)
1-12
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 specifcatons (i.e., performs to its
specifcatons)
• Cost: the ultmate total cost
1-13
Evaluation Criteria: Readability
• Overall simplicity
• A manageable set of features and constructs
• Few feature multplicity (means of doing the same operaton)
• Minimal operator overloading
• Orthogonality
• A relatvely small set of primitve constructs can be combined in a relatvely
small number of ways
• Every possible combinaton is legal
• ) Control statements
• The presence of well-known control structures (e.g., while statement
• Data types and structures
• The presence of adequate facilites for defning data structures
• Syntax consideratons
• Identfer forms: fexible compositon
• Special words and methods of forming compound statements
• Form and meaning: self-descriptve constructs, meaningful keywords
1-14
Evaluation Criteria: Writability
• Simplicity and orthogonality
• Few constructs, a small number of primitves, a small set of rules for combining
them
• Support for abstracton
• The ability to defne and use complex structures or operatons in ways that allow
details to be ignored
• Expressivity
• A set of relatvely convenient ways of specifying operatons
• Example: the inclusion of for statement in many modern languages
1-15
Evaluation Criteria: Reliability
• Type checking
• Testng for type errors
• Excepton handling
• Intercept run-tme errors and take correctve measures
• Aliasing
• Presence of two or more distnct referencing methods for the same
memory locaton
• Readability and writability
• A language that does not support “natural” ways of expressing an
algorithm will necessarily use “unnatural” approaches, and hence
reduced reliability
• Readability afects reliability in both the writng and maintenance phases
of the life cycle.
1-16
Evaluation Criteria: Cost
• Training programmers to use language
• Writng programs (closeness to partcular applicatons)
• Compiling programs
• Executng programs
• Language implementaton system: availability of free compilers
• Reliability: poor reliability leads to high costs
• Maintaining programs
1-17
Evaluation Criteria: Others
• Portability
• The ease with which programs can be moved from one implementaton to
another
• Generality
• The applicability to a wide range of applicatons
• Well-defnedness
• The completeness and precision of the language’s ofcial defniton
1-18
Why learn more than one PL?
• Computer Architecture
• Languages are developed around the prevalent computer architecture,
known as the von Neumann architecture
• Programming Methodologies
• New sofware development methodologies (e.g., object-oriented sofware
development) led to new programming paradigms and by extension, new
programming languages
1-21