CS 322 Programming Language Concepts - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

CS 322 Programming Language Concepts

Description:

Learn different languages, C, C , Java, Lisp, etc. ... Famous Software Bugs ... The Ariane 5 rocket exploded on its maiden flight in June 1996 ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 18
Provided by: sam73
Category:

less

Transcript and Presenter's Notes

Title: CS 322 Programming Language Concepts


1
CS 322Programming Language Concepts
2
Logistics
  • All handouts will be kept on-line
  • Course Home Page
  • http//csce.unl.edu/samal/class/FALL/f06/322/322.
    htm

3
Study programming languages Why?
  • Use of existing languages
  • Vocabulary of useful programming constructs
  • Better choice of programming languages
  • Ease of learning new languages
  • Ease of designing new languages
  • Develop effective algorithms

4
Study programming languages How?
  • Grand Tour
  • Learn different languages, C, C, Java, Lisp,
    etc.
  • Languages become obsolete and new languages are
    designed all the time.
  • Principles
  • Learn the underlying principles, vocabulary,
    structure and meaning
  • More enduring

5
If you give a man a fish he will have a single
meal. If you teach him how to fish, he will eat
all his life. Kuan-tzu (Chinese Philosopher)
6
Design Principles
  • Syntax
  • What is a correctly written program?
  • What are the basic building blocks?
  • Vocabulary of words
  • What rules guide how the words are put together
    to make a correct program?
  • Context-Free Grammars

7
Design Principles
  • Type systems and Semantics
  • What does a program/fragment/construct mean?
  • Important for program correctness.
  • Formal approaches are needed to answer this
    systematically.

8
Design Principles
  • Memory Management
  • How do the program elements map to physical
    memory?
  • Variables, data structures
  • Function call, recursion
  • Static and dynamic memory
  • Dynamic memory management
  • Objects have definite life spans
  • Garbage collection
  • Essential to have an understanding

9
Design Principles
  • Exception Handling
  • How does a program prepare for unexpected events
    during its execution?
  • Division by zero
  • Improper/illegal input
  • Exceptions
  • Programs must trap exceptions and provide
    alternative paths or graceful exit.

10
Famous Software Bugs
  • NASA Mars Climate Orbiter destroyed due to
    incorrect orbit insertion (September 23, 1999).
  • one team used English units (e.g., inches, feet
    and pounds) while the other used metric units
  • Therac-25 (1985-1987)
  • Six people were overexposed during radiation
    treatments for cancer by Canada's Therac-25
    radiation therapy machine
  • The Ariane 5 rocket exploded on its maiden flight
    in June 1996
  • Navigation package was inherited from the Ariane
    4
  • The new rocket flew faster, resulting in larger
    values of some variables in the navigation
    software.  
  • Shortly after launch, an attempt to convert a
    64-bit floating-point number into a 16-bit
    integer generated an overflow. 
  • The error was caught, but the code that caught it
    elected to shut down the subsystem. .  
  • Software Errors Cost U.S. Economy 59.5 Billion
    Annually (2002)

11
Programming Paradigms
  • Many different languages
  • Only a few different styles of programming
  • Imperative Programming
  • Object-oriented Programming
  • Functional Programming
  • Logic Programming
  • Event-Driven Programming
  • Concurrent Programming

12
Imperative Programming
  • Program is a series of steps
  • Retrieves input
  • Perform some computation
  • Generates output
  • Essential building blocks
  • Assignments
  • Procedures
  • Control structures
  • Examples Fortran, C, Cobol

13
Object-Oriented Programming
  • Program is a collection of objects
  • Interaction between objects is via message
    passing
  • Essential building blocks
  • Object modeling
  • Inheritance, polymorphism
  • Examples C, Java, Smalltalk

14
Functional Programming
  • Program is a collection of mathematical functions
  • Have one or more arguments
  • Return a value
  • Essential building blocks
  • Composition
  • Recursion
  • Examples Lisp, Scheme, ML

15
Logic Programming
  • Program is a collection of logical declarations
  • Separation of logic (what) and control (how)
  • Natural choice to express non-determinism
  • Examples Prolog

16
Event-Driven Programming
  • Program is a continuous loop
  • Wait for some event
  • Respond to the event
  • Order of event is arbitrary
  • Increased attention due to GUIs
  • Examples Visual Basic, Java

17
Concurrent Programming
  • Program is a set of cooperating processes
  • Each process works on its own
  • Shares information with others from time to time
  • Essential building blocks
  • Parallel constructs
  • Examples Linda, High Performance Fortran (HPF)
Write a Comment
User Comments (0)
About PowerShow.com