280 likes | 535 Views
Programming Languages. Xiaojuan Cai http://basics.sjtu.edu.cn/~xiaojuan/pl2014/. Do you know. how many programming languages in the world?. how to choose the most appropriate language for some given task?. There are strange(wierd) programming languages 99 Bottles of Beer.
E N D
Programming Languages • Xiaojuan Cai • http://basics.sjtu.edu.cn/~xiaojuan/pl2014/
Do you know • how many programming languages in the world? • how to choose the most appropriate language for some given task? • There are strange(wierd) programming languages99 Bottles of Beer http://en.wikipedia.org/wiki/List_of_programming_languages
Roadmap • Why study PL? • Course overview • Policy
What is the best kind of car? Cars are used for rather different things: • Winning a Formula 1 race • Taking kids to soccer practice • Hauling a mattress • Getting the wind in your hair • Staying dry in the rain
More on cars • A good mechanic might have a specialty, but also understands how “cars” (not a particular make/model) work • The upholstery color isn’t essential (syntax) • A good mechanical engineer really knows how cars work, how to get the most out of them, and how to design better ones
More on cars • To learn how car pieces interact, it may make sense to start with a classic design rather than the latest model • A popular car may not be best • May especially not be best for learning how cars work
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…
Are all languages the same? Yes: • Any input-output behavior implementable in language X is implementable in language Y [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
Why study PL 1. Learning to think about software in “PL” way will make you a better programmer 2. It will also give you the mental tools and experience you need for a lifetime of confidently picking up new languages and ideas
Why study PL Good languages make it easier to establish, verify, and maintain the relationship between code and its properties. —Robert Harper An ideal language allows us to express easily what is useful for the programming task and at the same time makes it difficult to write what leads to incomprehensible or incorrect programs. —Nico Habermann
Roadmap • Why study PL? • Course overview • Policy
Five different things 1. Syntax: How do you write language constructs? 2. Semantics: What do programs mean? (Evaluation rules) 3. Idioms: What are typical patterns for using language features to express your computation? 4. Libraries: What facilities does the language (or a well-known project) provide “standard”? (E.g., file access, data structures) 5. Tools: What do language implementations provide to make your job easier? (E.g., REPL, debugger, code formatter, …) These are 5 separate issues • In practice, all are essential for good programmers • Many people confuse them, but shouldn’t
Our Focus This course focuses on semantics and idioms • Syntax is usually uninteresting • Libraries and tools crucial, but often learn new ones “on the job” • We are learning semantics and how to use that knowledge to understand all software and employ appropriate idioms • By avoiding most libraries/tools, our languages may look “silly” but so would any language used this way
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
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 homework: 4,000 • Turned in 5th homework: 2,100 attrition doesn’t stop • “Passed”: 1,716 • Fan mail/posts: 300 • Consistent with “hard” course in Coursera!
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 (can’t explain that yet) • But many other topics too
Course overview • Use ML, Racket, and Ruby languages: • They let many of the concepts“shine” • Using multiple languages shows how the same concept can “look different” or actually be slightly different (comparison) • In many ways simpler than Java, C#, Python, …
Roadmap • Why study PL? • Course overview • Policy
Instructor and TAs • 蔡小娟 (Instructor)Office: Software building 1210Email: cxj@sjtu.edu.cn • 靳阳 (for graduates)Office: Dianxin building 3-329Email: jyjz2008@sjtu.edu.cn • 马晓明 (for undergraduates)Office: Software buildingEmail: xinj2012sjtu@sjtu.edu.cn
First things we need to do • Roster • Mini-course (about 5-10min for one PL, everyone has this chance!) • Recitation section – by group(8 groups for 7 assignments and 1 midexam)
Policy • Final score = 30% mid exam + 40% final exam + 30% otherwhereother = 70% homework + 15% mini-course + 15% recitation section • Exams cover topics harder to re-enforce with “just programming” because this is not just a programming course
More on homework • 7 assignments • Challenge problems: Low points/difficulty ratio • 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. Only (2) is graded, but focusing on (2) makes homework harder
More on homework • Every word you submit should be your own! • Cheating: copy codes from other sources. You will directly get a fail score. • Maybe we will have a auto-grading system (still under construction)
More on mini-course • You can talk anything about the language:history? who invented it? why? some stories? paradigm? what “hello world” program looks like? what it famous for? what tasks it good for? .... • Try to make it fun and make us remember your language!!!
More on recitation section • When: in one week after the homework deadline, or mid-exam • What: review topics we have learnt, explain the solutions of homework especially on those that most students go wrong. • How: read and analyze the submitted codes together with TAs, make slides if necessary.
“Sleep now, Dreams will come out; Study now, Dreams will come true.” -- selected from Allocutions on the Wall of the Harvard University Library