Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University,

Similar presentations


Presentation on theme: "Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University,"— Presentation transcript:

1 Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University, Houston January, 2008

2 2 Structure of the Lectures Review of the last lecture Summary of what will be covered Main contents Summary of what was covered Suggestions for the lecture

3 3 Homework Goals  Learn programming techniques  Reinforce the lecture material  Evaluate your comprehension Exercises and Problems  Understand concepts and put them in practice A good preparation for the exams!

4 4 Some Course Goals Programming Language Concepts  Learn useful concepts and programming methods  Understand the languages you use, by comparison  Appreciate history, diversity of ideas in programming  Be prepared for new programming methods, paradigms, tools Language design and implementation trade-off  Every convenience has its cost Recognize the cost of presenting an abstract view of machine Understand trade-offs in programming language design

5 5 Computer and Programming The Computer Age did not really begin until the first computer was made available to the public in 1951 (Seyed. H. Roosta) Modern computers are highly complex system  Hardware  Operating System  Middleware  Application layers Programming a computer is primarily designing and using abstractions to achieve new goals  Enormous number of abstractions work together in a highly organized manner

6 6 Abstractions Eliminate detail unnecessary for solving a particular problem  Complexity is hidden Open build upon one another  Allow us to solve increasingly complex problems Modern software’s complexity has no precedent  Abstractions are absolutely necessary to manage this complexity

7 7 Languages as Abstractions Human languages are a tool for abstracting thought  Example: “When I am warm I turn on the fan.” A statement communicates a simple intention The cognitive and neurological conditions from which the intention arose are most likely too complex for anyone to understand Meaning of the statement is left to the understanding of the individual who utters it and ones who hear it

8 8 Languages as Abstractions (cont’) Programming Languages  “Conceptual universe” (Perlis) Framework for problem-solving  A software tool for abstracting computation  Interface between clients and lower-level facilities (Implementation) Clients are usually humans or their programs Lower-level facilities can be files or operating systems  Example: if (temperature() > 30.0) { turn_on_fan(); } A statement involves a complex, but concrete sequence of actions Meaning of the statement is fixed by the formal semantics of the programming language and by the implementations of the functions

9 9 Evolution of Programming Languages Hardware Machine code Assembly Macro Assembly FORTRAN 1954 etc.  Programming in machine code or Assembly is way too tedious/error-prone

10 10 History of Programming Languages See the poster from O’Reilly

11 11 Why So Many Languages? Evolution  From goto to loops, case statements Personal Preference  Syntax  Loops vs. recursion  Pointers vs. recursive data types Special Purposes

12 12 Application Domains Scientific applications (Fortran, TCE) Business applications (Cobol) Artificial intelligence (LISP) Systems programming (C, C++) Web service programming (Java, C#) Very High-Level Languages (perl) Special purpose languages (make, sh)

13 13 What Makes a Language Succeed? Expressive Power Ease of Use for Novice Ease of Implementation Open Source Availability of Compilers, Libraries Economics, Patronage, Inertia Syntax that looks like C

14 14 Language Design Issues Readability Abstractions (functions, classes) Orthogonality (no special cases) Reliability (type checking) Cost (training programmers)

15 15 Why Do We Study Programming Languages? Understand obscure language features Choose among ways to express ideas Make good use of debuggers, other tools Simulate nice features in other languages Choose appropriate language for problem Learn new languages faster Design simple languages

16 16 Computation Models A computation model is a formal system that defines a language and how sentences of the language are executed by the abstract machine  i.e. how computations are done A programming paradigm is a style of programming a computer  A set of programming techniques and design principles to write programs in a language  Built on top of a computation model

17 17 Computation Models and Programming Paradigms Declarative Programming  Functional or logic programming Procedural/Imperative Programming Object-Oriented Programming Concurrent Programming  Multiple independent processes (running on the same CPU or distributed across multiple CPUs/computers)  Communication between processes via Dataflow Exchanging messages Sharing state

18 18 Languages for Programming Paradigms Functional programming  LISP/Scheme, ML, Haskell Logic programming  Prolog, SQL, Microsoft Excel Imperative programming  Fortran, Pascal, Basic, C Object-Oriented programming  Smalltalk, C++, Java, CLOS Concurrent programming for real-time systems  Erlang

19 19 Models with Which You Are Already Familiar You already know Java, which supports  Programming with state (Procedural/Imperative programming)  Object-oriented programming It is clear that these two models are important!

20 20 Languages in Common Use Compiled by François Labelle from statistics on open-source projects at SourceForge

21 21 Questions Worth Discussing for Programming Languages What is the structure (syntax) and meaning (semantics) of the programming language constructs? How does the compiler writer deal with these constructs in compilation? Is the programming language good for the programmer?  Easy to use?  Expressive power?  Readable?  Easy to detect programming error?

22 22 What’s New in Programming Languages Commercial trend over past 5 years  Increasing use of type-safe languages: Java, C#, …  Scripting languages, other languages for web applications Teaching trends  Java replacing C as most common introduction language Less emphasis on how data, control represented in machine Research and development trends  Modularity Java, C++: standardization of new module features  Program analysis Automated error detection, programming environment, compilation  Isolation and security Sandboxing, language-based security, …

23 23 What’s Worth Studying? Dominant languages and paradigms  C, C++, Java  Imperative and Object-oriented languages Important implementation ideas Performance challenges  Concurrency Design tradeoffs Concepts that research community is exploring for new programming languages and tools

24 24 Fundamental Concepts of Programming Languages Variables  declaration, binding, identifier, variable in memory, scope of a variable Identifier, Literals, Expressions Data types  integers, floating-point numbers, … Data structures  stack, queue, list, … Control structures  loops, conditional statements

25 25 Fundamental Concepts of Programming Languages (cont’) Function, procedures and parameter passing  definition, call (application) Recursion  For example, inductive definition of a function Block structures Runtime store organization

26 26 Implementation Methods Interpretation (early Lisp) Compilation (C, ML) Compiler Source Program Target Program InputOutput Interpreter Source Program Input Output

27 27 Implementation Methods (cont’) Hybrid Systems (early Java) Translator Source Program Intermediate Program Virtual Machine Input Output Intermediate Program

28 28 Overview of Compilation Scanner (Lexical Analysis) Parser (Syntax Analysis) Semantic Analysis and Intermediate Code Generation Machine-Independent Code Improvement (optional) Target Code Generation Machine-Specific Code Improvement (optional) Symbol Table Character Stream Token Stream Parse Tree Abstract Syntax Tree or Other Intermediate Form Assembly or Machine Language or Other Target Language Modified Target Language Modified Intermediate Form


Download ppt "Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University,"

Similar presentations


Ads by Google