Welcome! CSE341: Programming Languages Lecture 1 Course Mechanics ML Variable Bindings. Concise to-do list. Who: Course Staff.

Similar documents
CSE373: Data Structures and Algorithms Lecture 1: Introduction; ADTs; Stacks/Queues. Linda Shapiro Spring 2016

SuperSpeed Math. Addition, Subtraction, Multiplication, Division And the Gnarlies!

HOW TO SUCCEED WITH NEWSPAPER ADVERTISING

How to Study Mathematics Written by Paul Dawkins

Aim To help students prepare for the Academic Reading component of the IELTS exam.

Relative and Absolute Change Percentages

CS 43: Computer Networks Course Introduction. Grab a clicker and please sit towards the front, next to other students!

TEST-TAKING STRATEGIES FOR READING

A bigger family, a better future.

Planning a Class Session

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

What Have I Learned In This Class?

Using games to support. Win-Win Math Games. by Marilyn Burns

Dynamic Programming Problem Set Partial Solution CMPSC 465

Cambridge English: Preliminary (PET) Frequently Asked Questions (FAQs)

CLASSROOM ASSESSMENT TECHNIQUE EXAMPLES

Letter from the Editor-in-Chief: What Makes an Excellent Professor?

An Insiders Guide To Choosing An Honest, Reliable And Competent Computer Support Company

Christopher Seder Affiliate Marketer

Supplemental Activity

Planning and Writing Essays

Cambridge English: First (FCE) Frequently Asked Questions (FAQs)

How Can I Get the Money Flowing? (Transcript of Lecture found at

International Undergraduates Classroom Experiences

Coaching and Feedback

How to Pass Physics 212

Top Ten Mistakes in the FCE Writing Paper (And How to Avoid Them) By Neil Harris

(Refer Slide Time: 2:03)

Ten Strategies to Encourage Academic Integrity in Large Lecture Classes

Planning a Critical Review ELS. Effective Learning Service

Contents. 1 Introduction. CS 15 Collaboration Policy Fall Introduction Motivation Enforcement... 2

TECM 2700 Introduction to Technical Writing

The 2014 Ultimate Career Guide

xxx Lesson 19 how memory works and techniques to improve it, and (2) appreciate the importance of memory skills in education and in his or her life.

Becoming an Online Learner

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

McKinsey Problem Solving Test Top Tips

CS 378: Computer Game Technology

Online Web Learning University of Massachusetts at Amherst

REPUTATION MANAGEMENT SURVIVAL GUIDE. A BEGINNER S GUIDE for managing your online reputation to promote your local business.

New York University Stern School of Business Undergraduate College

Math: Study Skills, Note Taking Skills, And Test Taking Strategies

Expanding Expression Tool

Physics 230 Winter 2014 Dr. John S. Colton

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

CIS Information and Database Systems I. Course Syllabus Spring 2015

Preventing bullying: a guide for teaching assistants. SEN and disability: developing effective anti-bullying practice

CSC 281 Automata and Algorithms Spring 2009

Handbook on Test Development: Helpful Tips for Creating Reliable and Valid Classroom Tests. Allan S. Cohen. and. James A. Wollack

02-201: Programming for Scientists

HOW TO GET MORE WEBSITE TRAFFIC. laurence learntocodewith.me

CS 6371: Advanced Programming Languages

Reading and Taking Notes on Scholarly Journal Articles

THE 10 MOST POWERFUL CHANGES THAT WILL INCREASE SALES IN YOUR COMPANY IMMEDIATELY!

Online Courses: During the Course

Could you use more resources to help you learn & retain info? Do you create your own study aids to ensure you learn the course content?

WHY AND HOW TO REVISE

1. What aspects of your job do you enjoy? Please explain. The people coming in and out of the office constantly.

Sample Fraction Addition and Subtraction Concepts Activities 1 3

A fresh look at equity release

Intro to the Art of Computer Science

COS Course Assessment Student Responses

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Clients 201. Estimating Time and Writing proposals

Measuring the Impact of Volunteering

GETTING STARTED. Applying for the Integrated Social Sciences Online Bachelor's Program

Elementary pre-service mathematics teachers and technology: are they ready?

CS 51 Intro to CS. Art Lee. September 2, 2014

Components of a Reading Workshop Mini-Lesson

AMS 5 Statistics. Instructor: Bruno Mendes mendes@ams.ucsc.edu, Office 141 Baskin Engineering. July 11, 2008

Programming Languages

2 Mathematics Curriculum

Blackboard Development Checklist for Online Courses

Page 18. Using Software To Make More Money With Surveys. Visit us on the web at:

Outline. Written Communication Conveying Scientific Information Effectively. Objective of (Scientific) Writing

Becoming a Cambridge International School A guide to the registration process

OA3-10 Patterns in Addition Tables

Questioning Strategies to Engage Students

worksheet: personal history questions

Dom Jackson, Web Support Assistant Student Services Information Desk

Arkansas State PIRC/ Center for Effective Parenting

xxx Lesson Comprehend the writing process 2. Respond positively to the writing process

Fun for all the Family 3- Quite a few games for articles and determiners

COMPLETING AN APPRENTICESHIP APPLICATION FORM - TOP TIPS!

Arkansas State PIRC/ Center for Effective Parenting

GVPT 241, Political Theory: Ancient and Modern, fall 2014

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. CSC467 Compilers and Interpreters Fall Semester, 2005

CLASS PARTICIPATION: MORE THAN JUST RAISING YOUR HAND

Getting Started with 4-part Harmony

Peer Tutor Manual. Prepared by: Brian C. Jenkins. October 1, 2014

INSTRUCTION AT FSU THE FLORIDA STATE UNIVERSITY OFFICE OF DISTANCE LEARNING. A Guide to Teaching and Learning Practices

Methods for Assessing Student Learning Outcomes

How to Plan and Guide In Class Peer Review Sessions

The 5 P s in Problem Solving *prob lem: a source of perplexity, distress, or vexation. *solve: to find a solution, explanation, or answer for

WRITING EFFECTIVE REPORTS AND ESSAYS

MKT2413: Marketing Research Semester 2, 2013/2014

COURSE DESCRIPTION. Required Course Materials COURSE REQUIREMENTS

6th Grade Lesson Plan: Probably Probability

CS 40 Computing for the Web

Transcription:

Welcome! We have 10 weeks to learn the fundamental concepts of programming languages CSE341: Programming Languages Lecture 1 Course Mechanics ML Variable Bindings Dan Grossman Spring 2013 With hard work, patience, and an open mind, this course makes you a much better programmer Even in languages we won t use Learn the core ideas around which every language is built, despite countless surface-level differences and variations Poor course summary: Uses ML, Racket, and Ruby Today s class: Course mechanics [A rain-check on motivation] Dive into ML: Homework 1 due Wednesday of next week 2 Concise to-do list Who: Course Staff In the next 24-48 hours: 1. Read course web page: http://www.cs.washington.edu/education/courses/cse341/13sp/ 2. Read all course policies (4 documents on web page) 3. Adjust class email-list settings as necessary 4. Complete Homework 0 (survey worth 0 points) Dan Grossman: Faculty, 341 my favorite course / area of expertise TA: Amaris Chen TA: Patrick Larson TA: Josiah Adams Get to know us! 5. Get set up using Emacs and ML Installation/configuration/use instructions on web page Essential; non-intellectual No reason to delay! 3 4 Staying in touch Course email list: cse341a_sp13@u.washington.edu Students and staff already subscribed You must get announcements sent there Fairly low traffic Course staff: cse341-staff@cs.washington.edu plus individual emails Message Board For appropriate discussions; TAs will monitor Optional, won t use for important announcements Anonymous feedback link on webpage For good and bad: If you don t tell me, I don t know Lecture: Dan Slides, code, and reading notes / videos posted May be revised after class Take notes: materials may not describe everything Slides in particular are visual aids for me to use Ask questions, focus on key ideas Engage actively Arrive punctually (beginning matters most!) and well-rested Just like you will for the midterm! Write down ideas and code as we go If attending and paying attention is a poor use of your time, one of us is doing something wrong 5 6

Section Reading Notes and Videos Required: will usually cover new material Sometimes more language or environment details Sometimes main ideas needed for homework Will meet this week: using Emacs and ML Material often also covered in reading notes / videos Posted for each course unit: reading notes and videos that go over most (all?) of the material (and some extra stuff?) So why come to class? Because having these materials lets us make class-time much more useful Answer your questions without being rushed because occasionally didn t get to X; read about it Can point to occasional optional topics/videos Can try different things in class, not just recite things 7 8 Textbooks, or lack thereof Will treat the textbooks as optional, possibly useful references Look up details you want/need to know, but often in free online resources too Can provide second explanations, but (because!) they often take a fairly different approach If Dan s view confuses you, lecture, reading notes, and video might all confuse you Some topics aren t in the texts Office hours Regular hours and locations on course web [soon] Changes as necessary announced on email list Use them Please visit me Ideally not just for homework questions (but that s good too) Don t be surprised when I essentially ignore the texts List on web page what sections are most relevant Most but maybe not all of you will do fine without the texts Would love your feedback on if/how they are useful 9 10 Homework Seven total To be done individually Doing the homework involves: 1. Understanding the concepts being addressed 2. Writing code demonstrating understanding of the concepts 3. Testing your code to ensure you understand and have correct programs 4. Playing around with variations, incorrect answers, etc. Only (2) is graded, but focusing on (2) makes homework harder Challenge problems: Low points/difficulty ratio 11 Note my writing style Homeworks tend to be worded very precisely and concisely I m a computer scientist and I write like one (a good thing!) Technical issues deserve precise technical writing Conciseness values your time as a reader You should try to be precise too Skimming or not understanding why a word or phrase was chosen can make the homework harder By all means ask if a problem is confusing Being confused is normal and understandable And I may have made a mistake Once you re unconfused, you might agree the problem wording didn t cause the confusion 12

Academic Integrity Exams Read the course policy carefully Clearly explains how you can and cannot get/provide help on homework and projects Always explain any unconventional action I have promoted and enforced academic integrity since I was a freshman Great trust with little sympathy for violations Honest work is the most important feature of a university Midterm: Friday May 3, in class Final: Thursday June 13, 8:30-10:20 Yes, late in finals week Yes, you have to be here No, this was not my choice Same concepts, but different format from homework More conceptual (but write code too) Will post old exams Closed book/notes, but you bring one sheet with whatever you want on it 13 14 Coursera (more info in document) More Coursera I ve taught this material to thousands of people around the world A lot of work and extremely rewarding You are not allowed to participate in that class! Do not web-search related to homework problems! This should have little impact on you Two courses are separate 341 is a great class and staff is committed to this offering being the best ever But this is an exciting new thing you are likely curious about 15 Why are we doing this? Dan s answers: Have more impact (like a textbook) Experiment with where higher-ed might be going CSE / UW answers: Gain experience, be leaders So why are you paying tuition? Personal attention from humans Homeworks/exams with open-ended questions Class will adjust as needed We can be sure you actually learned Course is part of a coherent curriculum Beyond the classroom: job fairs, advisors, social, 16 Will Coursera help/hurt 341? Questions? Biggest risks Becomes easier to cheat don t! I become too resistant to change hope not! There are benefits too The videos More robust grading scripts Easier software installation (new SML Mode) Taking the VIP version of a more well-known course Change the world to be more 341-friendly Anything I forgot about course mechanics before we discuss, you know, programming languages? 17 18

What this course is about Why learn this? Many essential concepts relevant in any programming language And how these pieces fit together 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 In many ways simpler than Java Big focus on functional programming Not using mutation (assignment statements) (!) Using first-class functions (can t explain that yet) But many other topics too This is the normal place for course motivation Why learn this material? But in my experience, we don t have enough shared vocabulary So 3-4 week delay on motivation for functional programming I promise full motivation: delay is worth it (Will motivate immutable data at end of Unit 1 ) 19 20 My claim A strange environment Learning to think about software in this PL way will make you a better programmer even if/when you go back to old ways It will also give you the mental tools and experience you need for a lifetime of confidently picking up new languages and ideas [Somewhat in the style of The Karate Kid movies (1984, 2010)] Next 4-5 weeks will use ML language Emacs editor Read-eval-print-loop (REPL) for evaluating programs You need to get things installed and configured Either in the department labs or your own machine We ve written thorough instructions (questions welcome) Only then can you focus on the content of Homework 1 Working in strange environments is a CSE life skill 21 22 Mindset Let go of all programming languages you already know For now, treat ML as a totally new thing Time later to compare/contrast to what you know For now, oh that seems kind of like this thing in [Java] will confuse you, slow you down, and you will learn less Start from a blank file A very simple ML program [The same program we just wrote in Emacs; here for convenience if reviewing the slides] (* My first ML program *) val x = 34; val y = 17; val z = (x + y) + (y + 2); val q = z + 1; val abs_of_z = if z < 0 then 0 z else z; val abs_of_z_simpler = abs z 23 24

A variable binding The semantics val z = (x + y) + (y + 2); (* comment *) Syntax is just how you write something More generally: val x = e; Semantics is what that something means Type-checking (before program runs) Evaluation (as program runs) Syntax: Keyword val and punctuation = and ; Variable x Expression e Many forms of these, most containing subexpressions For variable bindings: Type-check expression and extend static environment Evaluate expression and extend dynamic environment So what is the precise syntax, type-checking rules, and evaluation rules for various expressions? Good question! 25 26 ML, carefully, so far A program is a sequence of bindings Type-check each binding in order using the static environment produced by the previous bindings Evaluate each binding in order using the dynamic environment produced by the previous bindings Dynamic environment holds values, the results of evaluating expressions So far, the only kind of binding is a variable binding More soon 27 Expressions We have seen many kinds of expressions: 34 true false x e1+e2 e1<e2 if e1 then e2 else e3 Can get arbitrarily large since any subexpression can contain subsubexpressions, etc. Every kind of expression has 1. Syntax 2. Type-checking rules Produces a type or fails (with a bad error message ) Types so far: int bool unit 3. Evaluation rules (used only on things that type-check) Produces a value (or exception or infinite-loop) 28 Variables Addition Syntax: sequence of letters, digits, _, not starting with digit Syntax: e1 + e2 where e1 and e2 are expressions Type-checking: Look up type in current static environment If not there fail Type-checking: If e1 and e2 have type int, then e1 + e2 has type int Evaluation: Look up value in current dynamic environment Evaluation: If e1 evaluates to v1 and e2 evaluates to v2, then e1 + e2 evaluates to sum of v1 and v2 29 30

Values Slightly tougher ones All values are expressions Not all expressions are values A value evaluates to itself in zero steps Examples: 34, 17, 42 have type int true, false have type bool () has type unit What are the syntax, typing rules, and evaluation rules for conditional expressions? What are the syntax, typing rules, and evaluation rules for less-than expressions? 31 32 The foundation we need We have many more types, expression forms, and binding forms to learn before we can write anything interesting Syntax, typing rules, evaluation rules will guide us the whole way! For homework 1: functions, pairs, conditionals, lists, options, and local bindings Earlier problems require less Will not add (or need): Mutation (a.k.a. assignment): use new bindings instead Statements: everything is an expression Loops: use recursion instead 33