CSCI-344 Programming Language Concepts (Section 3)
Total Page:16
File Type:pdf, Size:1020Kb
CSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein Hojjat August 22, 2016 1 Why Study Programming Languages? 1 2 3 What is programming? • Programming is way of communication: • Between human and computer: tell the machine what to do • Between humans: describe ideas about computation and algorithms \Programming is explaining to another human being what you want a computer to do." Donald Knuth (Renowned Computer Scientist) 4 • \Prince of Persia", was released in 1989 after over four years of work • Jordan Mechner wrote the program in machine language * Is there floor underfoot? If not, start to fall onground lda Fcheck and #fcheckmark beq ]rts ;0--no need to check jsr getunderft cmp #block bne :1 jsr InsideBlock ;If "inside" block, bump him outside :1 jsr cmpspace bne ]rts https://github.com/jmechner/Prince-of-Persia-Apple-II Early Programming • The first programs were hand-written directly in machine instructions 5 Early Programming • The first programs were hand-written directly in machine instructions • \Prince of Persia", was released in 1989 after over four years of work • Jordan Mechner wrote the program in machine language * Is there floor underfoot? If not, start to fall onground lda Fcheck and #fcheckmark beq ]rts ;0--no need to check jsr getunderft cmp #block bne :1 jsr InsideBlock ;If "inside" block, bump him outside :1 jsr cmpspace bne ]rts https://github.com/jmechner/Prince-of-Persia-Apple-II 5 C++ (C with Classes) 1980 Python (one of the first widely used scripting languages) 1991 Java (write once, run anywhere) 1995 Scala (object-oriented, functional programming) 2003 Dart (web, server and mobile applications) 2011 Julia (high-performance and scientific computing) 2012 Programming Languages Fortran (first optimizing compiler) 1957 LISP (first widely used functional language) 1958 Simula (first object-oriented language) 1962 BASIC (language for less technical users) 1964 PL/I (one language for all programmers) 1964 Pascal (encourage good programming practices) 1970 C (implementing UNIX operating system) 1972 Smalltalk (common object-oriented software design patterns) 1972 Prolog (one of the first logic programming languages) 1972 ML (polymorphic type inference) 1973 6 C++ (C with Classes) 1980 Python (one of the first widely used scripting languages) 1991 Java (write once, run anywhere) 1995 Scala (object-oriented, functional programming) 2003 Dart (web, server and mobile applications) 2011 Julia (high-performance and scientific computing) 2012 Programming Languages Fortran (first optimizing compiler) 1957 LISP (first widely used functional language) 1958 Simula (first object-oriented language) 1962 BASIC (language for less technical users) 1964 PL/I (one language for all programmers) 1964 Pascal (encourage good programming practices) 1970 C (implementing UNIX operating system) 1972 Smalltalk (common object-oriented software design patterns) 1972 Prolog (one of the first logic programming languages) 1972 ML (polymorphic type inference) 1973 • There are so many programming languages • \... today ... 1,700 special programming languages used to 'communicate' in over 700 application areas." • { Computer Software Issues, an American Mathematical Association Prospectus, July 1965. 6 Programming Languages Fortran (first optimizing compiler) 1957 LISP (first widely used functional language) 1958 Simula (first object-oriented language) 1962 BASIC (language for less technical users) 1964 PL/I (one language for all programmers) 1964 Pascal (encourage good programming practices) 1970 C (implementing UNIX operating system) 1972 Smalltalk (common object-oriented software design patterns) 1972 Prolog (one of the first logic programming languages) 1972 ML (polymorphic type inference) 1973 C++ (C with Classes) 1980 Python (one of the first widely used scripting languages) 1991 Java (write once, run anywhere) 1995 Scala (object-oriented, functional programming) 2003 Dart (web, server and mobile applications) 2011 Julia (high-performance and scientific computing) 2012 6 • Undo poor choices • Evolution: each generation improves over its predecessors • Taste: people have diverse interests in programming languages • Proprietary interest: economic benefits Programming Languages • Why are there so many programming languages? • Different tools for different jobs: hammers, cutters, saws, screwdrivers, knives, ... 7 • Taste: people have diverse interests in programming languages • Proprietary interest: economic benefits Programming Languages • Why are there so many programming languages? • Different tools for different jobs: hammers, cutters, saws, screwdrivers, knives, ... • Evolution: each generation improves over its predecessors • Undo poor choices 7 • Proprietary interest: economic benefits Programming Languages • Why are there so many programming languages? • Different tools for different jobs: hammers, cutters, saws, screwdrivers, knives, ... • Evolution: each generation improves over its predecessors • Undo poor choices • Taste: people have diverse interests in programming languages 7 Programming Languages • Why are there so many programming languages? • Different tools for different jobs: hammers, cutters, saws, screwdrivers, knives, ... • Evolution: each generation improves over its predecessors • Undo poor choices • Taste: people have diverse interests in programming languages • Proprietary interest: economic benefits 7 Course Goals • Fundamental concepts in the design and implementation of high-level programming languages • Understand paradigms, not surveying different programming languages • Emphasize some of the most important features or elements of programming languages • Analogy: periodic table of the elements in chemistry • Goal: understand the basic components of a programming language and how they combine or react with each another 8 Some Language Features • First-class functions • Pattern matching • Parametric polymorphism • Continuation • Objects and Inheritance • Algebraic Data-types 9 \Bridge" Programming Languages • We use \micro" languages (or bridge languages) based on \real" languages • Focus on essential features, eliminate superficial differences • Do-While loop, While loop, For loop • Pick a loop construct, desugar the rest do work(); do f while (condition) f do work(); do work(); g while (condition); g 10 Interpretation • We implement every micro-language by an interpreter • Interpreter shows the connection between the mathematical description of the language and its implementation language 1 (source) program Compiler Interpreter language 2 (target) results, behavior 11 Why do you need this course? • New programming languages are invented everyday • Need to understand the design and features of languages • Explore a large spectrum of possible programming techniques for solving a computational problem • Assess the trade-offs between different features, use languages effectively • Choose a programming language for a project in the future 12 Course Staff • Instructor: Hossein Hojjat (https://www.cs.rit.edu/~hh/) - University of Tehran (Bs. Software Engineering 2001 - 2005) - University of Tehran & TU Eindhoven (Msc. Software Engineering 2005 - 2007) - EPFL Lausanne, Switzerland (PhD Computer Science 2008 - 2013) - Cornell University (Postdoctoral Researcher 2014 - 2016) • Email: [email protected] • Office: GOL(70)-3545 • Class Hours: MWF 10:00AM-10:50AM • Office Hours: Tu 11am - 12am, Th 11am - 12am, Fr 4pm - 5pm • Webpage: - https://mycourses.rit.edu/ - https://cs.rit.edu/~hh/teaching/doku.php?id=plc16:top 13 Icebreaker Tell us about a programming project you're most proud of, and the size of that program, and the language you used for it, and why you chose that particular language! 14 Course Rhythm • Textbook reading • Reading quiz • Lectures: 1 { 3 class periods • Recitation: 1 class period • Programming assignment . • Final Exam 15 Reading Quizzes • Quizzes are on https://mycourses.rit.edu • Available 48 hrs before lecture that begins topic • First quiz is now available, check it out! • Short & Easy! • Approximately 30min with 90min time limit • Demonstrates that you have read the material 16 Course Work • 5%: Attendance & Participation (lectures) • 5%: Attendance & Participation (recitations) • 10%: Reading Quizzes (≈ 12) • 65%: Programming Assignments (≈ 8) • 15%: Final Exam - Dec. 16 (Friday) @ 10:15am 17 Participation • Lectures do not cover everything • You need to read the textbook, do the exercises, ... • Be responsible for your own learning and achievement! 18 Textbook • \Programming Languages: Build, Prove, and Compare" • Norman Ramsey, Tufts University • Unpublished draft, work in progress • Available for purchase at CS Dept. front office (∼ $35, cash only) 19 Academic Integrity • Read the academic integrity policy of RIT and the department • https://www.cs.rit.edu/SemesterConversion/common.html • If you aren't sure what is allowed and what isn't, please ask • This is about fairness: if you work hard for this course, you will not be treated as someone who does not 20 Questions • If you have any questions or concerns, please do not hesitate to send me an email or come to an office hour. 21.