Transcript Slide 1
Programming Languages – An introduction • There are 10 types of people in the world −Those who understand binary −Those who don’t Programming Languages • The purpose of language is simply that it must convey meaning. (Confucius) • That which can be said, can be said clearly. (Wittgenstein,1963) • A program is a specification of a computation. A programming language is a notation for writing programs.(Sethi,89) The Most Important Open Problem in Computing • Increasing Programmer Productivity − Write programs correctly − Write programs quickly − Write programs easily • Why? − Decreases support cost − Decreases development cost − Decreases time to market − Increases satisfaction How to increase Programmer Productivity? 3 ways of increasing programmer productivity: 1. Process (software engineering) • Controlling programmers • Good process can yield up to 20% increase 2. Tools (verification, static analysis, program generation) • Good tools can yield up to 10% increase • Language design --- the center of the universe! 3. Core abstractions, mechanisms, services, guarantees − Affect how programmers approach a task (C vs. SML) − New languages can yield 700% increase Why Are There So Many Programming Languages • Why does some people speak French? • Programming languages have evolved over time as better ways have been developed to design them. − First programming languages were developed in the 1950s − Since then thousands of languages have been developed • Different programming languages are designed for different types of programs. Different Programming language Design Philosophies C If all you have is a hammer, then everything looks like a nail. Other languages Influences on programming languages • Computer capabilities • Hardware and OS • Applications • Wide area of applications • Programming methods • Multiprogramming, interactive systems, data abstraction, formal semantics, O-O programming,… • Implementation methods • Theoretical studies • Standardization Attributes of a good language • Clarity, simplicity, and unity − Have a minimum number of different concepts, with the rules for their combination, simple and regular (conceptual integrity). − Readability • Orthogonality − Being able to combine various features of a language in all possible combinations. • Naturalness for the application • Support for abstraction Attributes of a good language • Ease of program verification − Proof of correctness, desk checking, test − Simplicity of semantic and syntax • Programming environment • Portability of programs • Cost of use − Program execution − Program translation − Program creation, testing, and use − Program maintenance Attributes of a good language • Reliability − Writability − Readability − Simplicity − Safety (goto, pointers) − Robustness • Maintainability − Factoring (modularity) − Locality • Efficiency Charles Babbage (1791-1871) The Father of Computers Charles Babbage’s Difference Engine Charles Babbage’s Analytical Engine Lady Augusta Ada Countess of Lovelace Programming Language History 1940s • The first electronic computers were monstrous contraptions − Programmed in binary machine code by hand − Code is not reusable or relocatable − Computation and machine maintenance were difficult: • cathode tubes regularly burned out • The term ‘‘bug’’ originated from a bug that reportedly roamed around in a machine causing short circuits Programming Language History Late 1940s early 1950s • Assembly languages − invented to allow machine operations to be expressed in mnemonic abbreviations − Enables larger, reusable, and re-locatable programs − Actual machine code is produced by an assembler − Early assemblers had a one-to-one correspondence between assembly and machine instructions − Later: expansion of macros into multiple machine instructions to achieve a form of higher-level programming Programming Language History Mid 1950s • Fortran , the first higher-level language − Now programs could be developed that were machine independent! − Main computing activity in the 50s: solve numerical problems in science and engineering − Other high-level languages soon followed: • • • • Algol 58 is an improvement compared to Fortran Cobol for business computing Lisp for symbolic computing and artificial intelligence BASIC for "beginners" Programming Language History 1960s • Structured Programming, Dijkstra, Dahl, and Hoare. • Pascal, Niklaus Wirth (ETH, Zurich) − Modelled after Algol − No GOTO − Very strongly typed − Procedures nested inside each other − Designed for teaching programming • Simula, Dahl and Nygaard (Norway) − The first language with objects, classes, and subclasses Programming Language History 1970s • C, Ken Thompson (Bell Labs) − Successor to B, which was stripped-down BCPL. − High-level constructs and low-level power • Ada, Jean Ichbiah (France) − Instigated by the Department of Defense − Designed for systems programming, especially embedded systems. Programming Language History 1970s • Smalltalk, Alan Kay, Adele Goldberg (Xerox PARC) − Graphics-rich • GUI • Fonts − Object-oriented • Everything is an object • Objects communicate through messages • Scheme, Gerald Sussman & Guy Steele (MIT) − LISP with static scoping • Prolog, Philippe Roussel (France) − Based on rules, facts, and queries. Programming Language History 1980s • Object-oriented programming − Important innovation for software development − The concept of a class is based on the notion of data type abstraction from Simula 67 , a language for discrete event simulation that has classes but no inheritance • 1979-1983: C++ Bjarne Stroustrop (Bell Labs) − Originally thought of as “C with classes”. − First widely-accepted object-oriented language. − First implemented as a pre-processor for the C compiler. Programming Language History 1980s • Functional Programming − Extensive list of new concepts • • • • • − − − − − Lazy vs. eager evaluation Pure vs. imperative features Parametric polymorphism Type inference (Garbage collection) Hope Clean Haskell SML Caml The 1990s: the Internet age • HTML, Tim Berners-Lee (CERN) − “Hypertext Markup Language” • Language of the World Wide Web. • Scripting languages − PERL. • CGI or Apache module − Languages within Web pages • JavaScript, VBScript • PHP, ASP, JSP • Some important languages that were developed in this time period include: − − − − − 1990 – Python 1991 – Java 1995 – PHP 1996 – ASP 2000 – C# Programming Language Genealogy Assembled, Compiled, or Interpreted Languages • All programs must be translated before their instructions can be executed. • Computer languages can be grouped according to which translation process is used to convert the instructions into binary code: − Assemblers − Interpreters − Compilers Assembled, Compiled, or Interpreted Languages • Assembled languages: − Assembler: a program used to translate Assembly language programs. − Produces one line of binary code per original program statement. − The entire program is assembled before the program is sent to the computer for execution. Assembled, Compiled, or Interpreted Languages • Interpreted Languages: − Interpreter: A program used to translate high-level programs. − Translates one line of the program into binary code at a time: • An instruction is fetched from the original source code. • The Interpreter checks the single instruction for errors. (If an error is found, translation and execution ceases. Otherwise…) • The instruction is translated into binary code. • The binary coded instruction is executed. • The fetch and execute process repeats for the entire program. Assembled, Compiled, or Interpreted Languages • Compiled languages: − Compiler: a program used to translate high-level programs. − Translates the entire program into binary code before anything is sent to the CPU for execution. − The translation process for a compiled program: • First, the Compiler checks the entire program for syntax errors in the original source code. • Next, it translates all of the instructions into binary code. − Two versions of the same program exist: the original source code version, and the binary code version (object code). • Last, the CPU attempts execution only after the programmer requests that the program be executed. Programming for Everyone • Scripting: A series of commands, written to accomplish some task. − Very similar to the concept of a program. − Extends the capabilities of the application where it is being used. − Examples of scripting languages: • Perl, VBScript, JavaScript • JavaScript: A scripting language that allows the Web page designer to add functional features to a formatted web page created in HTML. "Life was simple before World WarThe II. first computer After that, we Admiral Dr. had systems." • Rear Grace Murray Hopper bug