Programming Languages Xiaojuan Cai
Programming LanguagesSection 0 2 Do you know How many programming languages in the world? There are strange(weird) programming languages 99 Bottles of Beer 99 Bottles of Beer
Programming LanguagesSection 0 3 Roadmap Course overview Policy
Programming LanguagesSection 0 4 What is the best kind of car? What is the best PL?
Programming LanguagesSection 0 5 Cars tell us Cars are used for rather difference things. You can not be a great driver if you only ever drive one car. A good mechanic understands how “cars” work A good mechanical engineer knows how to design better ones To learn how car pieces interact, start with a classic design rather than the latest model.
Programming LanguagesSection 0 6 Are all cars the same? They all have steering wheels, brakes, windows, headlights, etc. still uncomfortable to learn a new one Can you be a great driver if you only ever drive one car? And maybe PLs are more like cars, trucks, boats, and bikes So are all PLs really the same…
Programming LanguagesSection 0 7 Are all languages the same? Yes: [Church-Turing thesis] Java, ML, and a language with one loop and three infinitely-large integers are “the same” Yes: Same fundamentals reappear: variables, abstraction, one- of types, recursive definitions, … No: The primitive/default in one language is awkward in another
Programming LanguagesSection 0 8 This course will show three languages with different paradigms; introduce a lot of fundamental concepts and key points; make you a better programmer by learning to think about software in “PL” way; give you the mental tools and experience you need for a lifetime of confidently picking up new languages and ideas.
Programming LanguagesSection 0 9 Five different things 1. Syntax 2. Semantics 3. Idioms 4. Libraries 5. Tools These are 5 separate issues In practice, all are essential for good programmers Many people confuse them, but shouldn’t
Programming LanguagesSection 0 10 Course overview Many essential concepts relevant in any programming language And how these pieces fit together Big focus on functional programming Not using mutation (assignment statements) (!) Using first-class functions But many other topics too
Programming LanguagesSection 0 11 The languages together ML: polymorphic types, pattern-matching, abstract types Racket: dynamic typing, “good” macros, minimalist syntax Ruby: classes but not types, very OOP, mixins dynamically typedstatically typed functionalRacketSML object-orientedRubyJava/C#
Programming LanguagesSection 0 12 Functional Programming Mutation is discouraged Higher-order functions are very convenient One-of types via constructs like datatypes 1. These features are invaluable for correct, elegant, efficient software 2. Functional languages have always been ahead of their time
Programming LanguagesSection 0 13 Ahead of their time All these were dismissed as “beautiful, worthless, slow things PL professors make you learn” Garbage collection (Java didn’t exist in 1995, PL courses did) Generics ( List in Java, C#), much more like SML than C++ Higher-order functions (Ruby, Javascript, C#, …) Type inference (C#, Scala, …) …
Programming LanguagesSection 0 14 Is this real programming? The way we use ML/Racket/Ruby can make them seem almost “silly” “Real” programming needs file I/O, string operations, floating-point, graphics, project managers, testing frameworks, threads, build systems, … Many elegant languages have all that and more Including Racket and Ruby
Programming LanguagesSection 0 15 Course overview Special thanks to Prof. Dan Grossman. Programming languages Coursera by Dan Grossman (about 65,000 people registered this course) Dan Grossman Professor, University of Washington
Programming LanguagesSection 0 16 Course data (Coursera, Jan 2013 session, provided by Prof. Grossman “Registered”: 65,000 totally irrelevant Clicked play in first 2 weeks: 27,000 Watched an hour of video: 12,000 like coming to first day? Turned in 1st homWework: 4,000 Turned in 5 th homework: 2,100 attrition doesn’t stop “Passed”: 1,716 Fan mail/posts: 300 Consistent with “hard” course in Coursera!
Programming LanguagesSection 0 17 Roadmap Course overview Policy
Programming LanguagesSection 0 18 Instructor and TAs 蔡小娟 (Instructor) Office: Software building 刘立 Office: Dianxin building
Programming LanguagesSection 0 19 Policy Final score = 40% homework + 60% final exam Exams cover topics harder to re-enforce with “just programming” because this is not just a programming course
Programming LanguagesSection 0 20 More on homework 7 assignments (for the first 16 lectures) Doing the homework involves: Understanding the concepts being addressed Writing code demonstrating understanding of the concepts Testing your code to ensure you understand and have correct programs “Playing around” with variations, incorrect answers, etc.
Programming LanguagesSection 0 21 More on homework Every word you submit should be your own! Cheating: copy codes from other sources. You will directly get a fail score.
Programming LanguagesSection 0 22 “ Sleep now, Dreams will come out; Study now, Dreams will come true.”