Why study Programming Languages? PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Why study Programming Languages?


1
Why study Programming Languages?
  • Increase your capacity to express ideas (both
    programming and in general)
  • Increase your ability to select a PL for a
    specific use
  • Increase your ability to learn new languages
  • Provide you with a better understanding of
    implementation issues in programming
  • Increase your ability to design a new PL
  • Provide you with a better understanding of
    computational theory

2
Language Evaluation Criteria
  • We will evaluate languages based on 5 criteria
  • Readability
  • Writability
  • Reliability
  • Cost
  • Tradeoffs

3
Readability
  • Simplicity of instructions
  • Simpler is better (consider how many ways you can
    incr in C/Java)
  • Orthogonality of instructions
  • Do we treat operations differently for different
    types?
  • for instance, do we add 2 floats differently from
    2 ints
  • Operator and method/function overloading keeps
    instructions orthogonal
  • too much orthogonality can cause problems though,
    in Smalltalk, everything is an object, even a
    number
  • Control statements
  • Early languages had insufficient control
    structures leading to extensive use of GO TO
    statements
  • most modern languages have adequate control
    statements so that GO TO statements are not
    needed and in many cases, not part of the
    language
  • what about statements like break and continue?
  • Data Types and Structures
  • Enumerable types, boolean type, add to readability

4
More on Readability
  • Another issue that impacts readability is of
    syntactic expression
  • identifier rules
  • early languages restricted length of names
  • modern languages may differentiate between upper
    and lower case letters
  • special words
  • those words that make up the language are known
    as special (or reserved) words, the choice of
    words can make a language more readable
  • explicit end statements (endif, endfor, enddo)?
  • form and meaning
  • are words reserved or based on context?
  • in C, the usage of static is based on context
  • in FORTRAN, INTEGER and REAL can be types and
    names
  • INTEGER REAL // REAL is an INTEGER
  • REAL INTEGER // INTEGER is a REAL

5
Writability
  • Simplicity and Orthogonality
  • simplicity has the same meaning as with
    readability, but the opposite effect
  • the more complex an instruction, the better for
    the programmer
  • Cs for loop is very flexible good for writing,
    not so good for reading
  • we still want orthogonal languages
  • if you have to learn different ways to accomplish
    some task in different contexts, it becomes more
    difficult to learn the language
  • Support for Abstraction (two types)
  • data abstraction (for data structures)
  • procedural abstraction (for modularity)
  • Expressitivity
  • does the language offer convenient ways to
    express ideas
  • are there sufficient control structures?
  • is the definition for a data type difficult or
    not available? etc.

6
Reliability
  • How reliable can a program be written in the
    given language?
  • Type Checking
  • does the language perform compile-time type
    checking?
  • how thoroughly are variables checked?
  • a strongly typed language will find all type
    mismatches at compile time
  • but few languages are strongly typed
  • subprogram parameter and global variable type
    checking is difficult
  • Exception Handling
  • pioneered in PL/I, not available in most
    languages until recently (C, Java)
  • Aliasing
  • two or more variables reference the same named
    item
  • most commonly associated with pointers and
    parameters
  • changing the item through one of the aliased
    names may be an unnoticed or undesired side
    effect
  • most languages do nothing to prevent aliases
  • Readability and Writability
  • the more readable the language, the more reliable
    it will be
  • the less writable the language, the greater the
    chance of hard-to-find errors

7
Cost and Other Factors
  • Cost is primarily a function of time
  • Training/Learning Curve
  • readability positively influences this,
    writability requires more training
  • Time to write programs (writability positively
    influences this)
  • Compilation Speed/Efficiency (affects programmer
    time)
  • Execution Speed/Efficiency
  • execution speed is desired because this what the
    user sees
  • most languages will sacrifice compilation speed
    for execution speed
  • Maintenance
  • a language that is more readable and reliable is
    easier to maintain
  • Other factors include portability, generality,
    well-definedness and standardization and legacy
    issues
  • Language selection can often be a tradeoff
    between
  • readability and flexibility/writability (more
    flexible makes it less readable)
  • cost and expressiveness
  • type checking/reliability and abstraction/flexibil
    ity
Write a Comment
User Comments (0)
About PowerShow.com