CSE341: Programming Languages Lecture 7.5 Course Motivation Dan Grossman Fall 2011.

Slides:



Advertisements
Similar presentations
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Winter 2013.
Advertisements

CSE341: Programming Languages Lecture 23 OO vs. Functional Decomposition; Adding Operations & Variants; Double-Dispatch Dan Grossman Fall 2011.
Programming Languages Xiaojuan Cai
CSE341: Programming Languages Lecture 13 Equivalence; Parametric Polymorphism Dan Grossman Fall 2011.
CSE341: Programming Languages Lecture 28 Victory Lap Dan Grossman Fall 2011.
CSE341: Programming Languages Lecture 2 Functions, Pairs, Lists Dan Grossman Fall 2011.
CSE341: Programming Languages Lecture 15 Mutation, Pairs, Thunks, Laziness, Streams, Memoization Dan Grossman Fall 2011.
CS 330 Programming Languages 09 / 13 / 2007 Instructor: Michael Eckmann.
CSE341: Programming Languages Interlude: Course Motivation Dan Grossman Spring 2013.
CSE341: Programming Languages Lecture 26 Course Victory Lap Dan Grossman Spring 2013.
CSE341: Programming Languages Lecture 26 Course Victory Lap Dan Grossman Winter 2013.
Introduction to Ruby CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341.
CSE 341 Programming Languages Racket Datatype Style Programming Zach Tatlock Spring 2014.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
CSE341: Programming Languages Lecture 22 OOP vs. Functional Decomposition; Adding Operators & Variants; Double-Dispatch Dan Grossman Spring 2013.
A-1 © 2000 UW CSE University of Washington Computer Programming I Lecture 21: Course Wrap-up and Look Ahead.
CS5205Introduction1 CS5205: Foundation in Programming Languages Lecture 0 : Overview Lecturer : Chin Wei Ngan Office : COM2.
Interfaces, Mixins, & Multiple Inheritance CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341, Sp08.
CSE 341 : Programming Languages Lecture 8 First Class Functions Zach Tatlock Spring 2014.
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Spring 2013.
서울대한양대 ( 안 산 ) 충남대 1년1년 컴퓨터기초 (C) 컴퓨터프로그래밍 (C, Java) 컴퓨터프로그래밍 (C) 2. 봄 프로그래밍 원리 (Scheme, ML) Structure & Interpretation of Computer Programs 프로그래밍 방법론.
Programming Languages Dan Grossman 2013 Optional: Course-Motivation Introduction.
CSE341: Programming Languages Lecture 26 Course Victory Lap
Programming Languages Dan Grossman 2013
CSE341: Programming Languages Interlude: Course Motivation
CSE341: Programming Languages Lecture 22 OOP vs
CSC207 Fall 2016.
Programming Languages Dan Grossman 2013
Programming Languages Dan Grossman 2013
Programming Languages Dan Grossman 2013
Programming Languages Dan Grossman 2013
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Spring 2017.
Programming Languages Dan Grossman 2013
CSE341: Programming Languages Interlude: Course Motivation
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Winter 2013.
CSE341: Programming Languages Lecture 22 OOP vs
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2013.
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Zach Tatlock Winter 2018.
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2017.
CSE341: Programming Languages Interlude: Course Motivation
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Spring 2013.
CSE 341: Programming Langs
CSE341: Programming Languages Lecture 26 Course Victory Lap
CSE341: Programming Languages Lecture 22 OOP vs
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Autumn 2018.
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Spring 2016.
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Autumn 2017.
CSE341: Programming Languages Interlude: Course Motivation
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Autumn 2017.
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Autumn 2018.
CSE341: Programming Languages Lecture 26 Course Victory Lap
CSE341: Programming Languages Lecture 26 Course Victory Lap
Dan Grossman / Eric Mullen Autumn 2017
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2016.
CSE341: Programming Languages Lecture 22 OOP vs
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 7 First-Class Functions
CSE341: Programming Languages Lecture 22 OOP vs
CSE341: Programming Languages Interlude: Course Motivation
CSE341: Programming Languages Lecture 7 First-Class Functions
Brett Wortzman Summer 2019 Slides originally created by Dan Grossman
CSE341: Programming Languages Lecture 14 Thunks, Laziness, Streams, Memoization Dan Grossman Spring 2019.
CSE341: Programming Languages Lecture 22 OOP vs
CSE341: Programming Languages Lecture 26 Course Victory Lap
CSE341: Programming Languages Lecture 26 Course Victory Lap
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2019.
Presentation transcript:

CSE341: Programming Languages Lecture 7.5 Course Motivation Dan Grossman Fall 2011

Course Motivation (Did you think I forgot? ) Why learn languages that are quite different from Java, C, C++? Why learn the fundamental concepts that appear in all (most?) languages? Why focus on functional programming? Fall 20112CSE341: Programming Languages

What is the best kind of car? What is the best kind of shoes? Fall 20113CSE341: Programming Languages

Cars / Shoes Cars are used for rather different things: –Winning the INDY 500 –Taking kids to soccer practice –Off-roading –Hauling a mattress –Getting the wind in your hair –Staying dry in the rain Shoes: –Playing basketball –Going to a formal –Going to the beach Fall 20114CSE341: Programming Languages

More on cars A good mechanic might have a specialty, but also understands how “cars” (not 2004 Honda Civics) work –And that the syntax, I mean upholstery color, isn’t essential A good mechanical engineer really knows how cars work, how to get the most out of them, and how to design better ones To learn how cars work, it may make sense to start with a classic design rather than the latest model –A popular car may not be a good car for learning how cars work Fall 20115CSE341: Programming Languages

All cars are the same To make it easier to rent cars, it’s great that they all have steering wheels, brakes, windows, headlights, etc. –Yet it’s still uncomfortable to learn a new one And maybe PLs are more like cars, trucks, boats, and bikes So are all PLs really the same… Fall 20116CSE341: Programming Languages

Are all languages the same? Yes: –Any input-output behavior implementable in language X is implementable in language Y [Church-Turing thesis, CSE431] –Java, ML, and a language with one loop and three infinitely- large integers are “the same” –Beware “the Turing tarpit” Yes: –Same fundamentals reappear: variables, abstraction, one-of types, recursive definitions, … No: –The human condition vs. different cultures (travel to learn more about home) –The primitive/default in one language is awkward in another Fall 20117CSE341: Programming Languages

A note on reality Reasonable questions when deciding to use/learn a language: What libraries are available for reuse? What can get me a summer internship? What does my boss tell me to do? What is the de facto industry standard? What do I already know? CSE341 by design does not deal with these questions –You have the rest of your life for that –And technology leaders affect the answers Fall 20118CSE341: Programming Languages

Why semantics and idioms This course focuses as much as it can on semantics and idioms Correct reasoning about programs, interfaces, and compilers requires a precise knowledge of semantics –Not “I feel that conditional expressions might work like this” –Not “I like curly braces more than parentheses” –Much of software development is designing precise interfaces; what a PL means is a really good example Idioms make you a better programmer –Best to see in multiple settings, including where they shine –See Java in a clearer light even if I never show you Java Fall 20119CSE341: Programming Languages

Hamlet The play Hamlet: –Is a beautiful work of art –Teaches deep, eternal truths –Is the source of some well-known sayings –Makes you a better person Continues to be studied (even in college) centuries later even though: –The syntax is really annoying to many (yet rhythmic) –There are more popular movies with some of the same lessons (just not done as well) –Reading Hamlet will not get you a summer internship Fall CSE341: Programming Languages

Functional Programming Okay, so why 70-80% of course with functional languages, i.e., languages where: –Mutation is discouraged –One-of types via constructs like datatypes –Higher-order functions are very convenient Because: 1.These features are invaluable for correct, elegant, efficient software (great way to think about computation) 2.Functional languages have always been ahead of their time 3.Functional languages well-suited to where computing is going Most of course is on (1), so a few minutes on (2) and (3) … Fall CSE341: Programming Languages

Ahead of their time All of these were dismissed as “beautiful, worthless, slow things PL professors make you learn in school” Garbage collection (Java didn’t exist in 1995, CSE341 did) Generics ( List in Java, C#), much more like SML than C++ XML for universal data representation (like Racket/Scheme/LISP) Higher-order functions (Ruby, Javascript, C#, …) Type inference (C#) Recursion (a big fight in 1960 about this – I’m told ) … Somehow nobody notices we are right (20 years later) Maybe pattern-matching, currying, hygienic macros, etc. will be next “To conquer” vs. “to assimilate” Fall CSE341: Programming Languages

Recent Surge Microsoft: F#, C# 3.0, LINQ Scala (Twitter, LinkedIn, FourSquare) Java 8 (?), C++ (?) MapReduce / Hadoop (everybody) –Avoiding side-effects essential for fault-tolerance here Haskell (dozens of small companies/teams) Erlang (distributed systems, Facebook chat) Ocaml (JaneStreet) … Honestly, SML and its implementations are showing their age, but Ocaml and F# are very similar and other functional languages also much easier to learn Fall CSE341: Programming Languages

Why a surge? My best guesses: Concise, elegant, productive programming Javascript, Python, Ruby helped break the Java/C/C++ hegemony –And these functional languages do some things better Avoiding mutation is the easiest way to make concurrent and parallel programming easier Sure, functional programming is still a small niche, but there is so much software in the world today even niches have room See separate list of links to “where is functional used” on the course web page Fall CSE341: Programming Languages

Is this real programming? The way we use ML/Racket/Ruby in 341 can make them seem almost “silly” precisely because lecture and homework focus on interesting language constructs “Real” programming needs file I/O, string operations, floating- point, graphics, project managers, testing frameworks, threads, build systems, … –Functional languages have all that and more –If we used Java the same way in CSE341, Java would seem “silly” too Fall CSE341: Programming Languages

The languages together Why SML, Racket, and Ruby are a useful combination for us dynamically typedstatically typed functional Racket SML object-oriented Ruby Java ML: polymorphic types, pattern-matching, abstract types & modules Racket: dynamic typing, “good” macros, minimalist syntax, eval Ruby: classes but not types, very OOP, mixins [and much more] Really wish we had more time: Haskell: laziness, purity, type classes, monads Prolog: unification and backtracking [and much more] Fall CSE341: Programming Languages

Summary No such thing as a “best” PL There are good general design principles for PLs A good language is a relevant, crisp interface for writing software Software leaders should know PL semantics and idioms Learning PLs is not about syntactic tricks for small programs Functional languages have been on the leading edge for decades –Ideas get absorbed by the mainstream, but very slowly –Meanwhile, use the ideas to be a better C/Java/PHP hacker Fall CSE341: Programming Languages