Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Similar documents
Introduction to Nate Foster Spring 2018

Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

CMSC 330: Organization of Programming Languages. Functional Programming with OCaml

CS 3110 Lecture 1 Course Overview

Lists. Prof. Clarkson Fall Today s music: "Blank Space" by Taylor Swift

Victory Lap. Prof. Clarkson Fall Today s music: We are the Champions by Queen

Introduction to OCaml

CS457/557 Functional Languages

CS Introduction to Security. Prof. Clarkson Spring 2017

Functions. Nate Foster Spring 2018

15-411/ Compiler Design

COSE212: Programming Languages. Lecture 0 Course Overview

Mutable Data Types. Prof. Clarkson Fall A New Despair Mutability Strikes Back Return of Imperative Programming

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims

Programming Languages and Techniques (CIS120)

Welcome to CS 135 (Fall 2018) Themes of the course. Lectures. cs135/

Lecture 1: Overview

Functional Programming

CS Lecture 5: Pattern Matching. Prof. Clarkson Fall Today s music: Puff, the Magic Dragon by Peter, Paul & Mary

61A LECTURE 1 FUNCTIONS, VALUES. Steven Tang and Eric Tzeng June 24, 2013

CS 11 Haskell track: lecture 1

CS558 Programming Languages

Welcome to CS 135 (Winter 2018)

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

CS Lecture 6: Map and Fold. Prof. Clarkson Fall Today s music: Selections from the soundtrack to 2001: A Space Odyssey

Announcements. 1. Forms to return today after class:

TA hours and labs start today. First lab is out and due next Wednesday, 1/31. Getting started lab is also out

WELCOME TO CS 16! Enrollment status: 117/ Problem Solving with Computers-I

Lecture 1. Course Overview, Python Basics


Lecture 1. Course Overview, Python Basics

COMP-202 Unit 0: Course Details

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing

Introduction, Functions

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

Lecture 5 Abstract Data Types

Outline. CIS 110: Introduction to Computer Programming. What is Computer Science? What is computer programming? What is computer science?

CSE 332: Data Abstractions. Ruth Anderson Spring 2014 Lecture 1

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

CS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Lecture 1. Course Overview Types & Expressions


Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE : Fall 2017

Programming Languages

CS558 Programming Languages

ECE Object-Oriented Programming using C++ and Java

Programming Languages and Techniques (CIS120)

Course Overview, Python Basics


CS 6371: Advanced Programming Languages

Type Inference. Prof. Clarkson Fall Today s music: Cool, Calm, and Collected by The Rolling Stones

Languages and Compilers

CS 241 Data Organization using C

CS 241 Data Organization. August 21, 2018

CIS192: Python Programming

CSE 417 Practical Algorithms. (a.k.a. Algorithms & Computational Complexity)

Welcome to... CS113: Introduction to C

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

Introduction to Computer Systems

WELCOME TO CS 16! Problem Solving with Computers-I.

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

Haskell in the Software Industry

Compiler Design Spring 2018

CS153: Compilers Lecture 1: Introduction

Marketing Whitepaper: 8 Steps To Increasing Your Sales With Marketing

Chapter 4C Homework Functions III Individual Assignment 30 Points Questions 6 Points Script 24 Points

CS1110 Lab 1 (Jan 27-28, 2015)

CS270 Computer Organization Fall 2017

Programming Languages

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

CS 140 Programming with Objects

CISN 340 Data Communication and Networking Fundamentals Fall 2012 (Hybrid)

Data Types. Prof. Clarkson Fall Today s music: Pokémon Theme by Jason Paige

CS21: INTRODUCTION TO COMPUTER SCIENCE. Prof. Mathieson Fall 2017 Swarthmore College

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

CSC 172 Data Structures and Algorithms. Fall 2017 TuTh 3:25 pm 4:40 pm Aug 30- Dec 22 Hoyt Auditorium

CSCD 330 Network Programming Spring Lecture 1 - Course Details

(0) introduction to the course. how to learn a programming language. (0) course structure

COS 326 Functional programming: an elegant weapon for the modern age

CSE 240 Introduction to Computer Architecture

CS 4349 Lecture August 21st, 2017

Spring 2018 El Camino College E. Ambrosio. Course Syllabus

BOSTON UNIVERSITY Metropolitan College MET CS342 Data Structures with Java Dr. V.Shtern (Fall 2011) Course Syllabus

To figure this out we need a more precise understanding of how ML works

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE 130 : Fall 2014

(1) It is your responsibility to drop the class; failure to drop the class in a timely manner could result in a W or F on your record.

COSE212: Programming Languages. Lecture 3 Functional Programming in OCaml

CSc 372 Comparative Programming Languages

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

Chapter 11 :: Functional Languages

Welcome to Computer Organization and Design Logic

Administration. Conditional Statements. Agenda. Syntax. Flow of control. Lab 2 due now on floppy Lab 3 due tomorrow via FTP

(1) It is your responsibility to drop the class; failure to drop the class in a timely manner could result in a W or F on your record.

Welcome to CS 241 Systems Programming at Illinois

Introduction to Computer Systems

Transcription:

Introduction to 3110 Prof. Clarkson Fall 2017 Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Welcome! Programming isn t hard Programming well is very hard High variance among professionals productivity: 10x or more Studying functional programming will make you a better programmer, but it requires an open mind

What is a functional language? A functional language: defines computations as mathematical functions avoids mutable state State: the information maintained by a computation Mutable: can be changed (antonym: immutable)

Functional vs. imperative Functional languages: Higher level of abstraction Easier to develop robust software Immutable state: easier to reason about software Imperative languages: Lower level of abstraction Harder to develop robust software Mutable state: harder to reason about software You don t have to believe me now. If you master a functional language, you will. J

Imperative programming Commands specify how to compute by destructively changing state: x = x+1; a[i] = 42; p.next = p.next.next; Functions/methods have side effects: int wheels(vehicle v) { v.size++; return v.numwheels; }

Mutability The fantasy of mutability: It's easy to reason about: the machine does this, then this... The reality of mutability: Machines are good at complicated manipulation of state Humans are not good at understanding it! mutability breaks referential transparency: ability to replace expression with its value without affecting result of computation mutable programming is not well-suited to building correct code!

Functional programming Expressions specify what to compute Variables never change value Functions never have side effects The reality of immutability: No need to think about state Powerful ways to build correct programs

Why study functional programming? 1. Functional languages teach you that programming transcends programming in a language (assuming you you have only programmed in imperative languages) 2. Functional languages predict the future 3. (Functional languages are sometimes used in industry) 4. Functional languages are elegant

Why study functional programming? 1. Functional languages teach you that programming transcends programming in a language (assuming you you have only programmed in imperative languages) 2. Functional languages predict the future 3. (Functional languages are sometimes used in industry) 4. Functional languages are elegant

Analogy: studying a foreign language Learn about another culture; incorporate aspects into your own life Shed preconceptions and prejudices about others Understand your native language better

Alan J. Perlis A language that doesn't affect the way you think about programming is not worth knowing. 1922-1990 First recipient of the Turing Award for his influence in the area of advanced programming techniques and compiler construction 11

Why study functional programming? 1. Functional languages teach you that programming transcends programming in a language (assuming you you have only programmed in imperative languages) 2. Functional languages predict the future 3. (Functional languages are sometimes used in industry) 4. Functional languages are elegant

Functional languages predict the future Garbage collection Java [1995], LISP [1958] Generics Java 5 [2004], ML [1990] Higher-order functions C#3.0 [2007], Java 8 [2014], LISP [1958] Type inference C++11 [2011], Java 7 [2011] and 8, ML [1990] What's next?

Why study functional programming? 1. Functional languages teach you that programming transcends programming in a language (assuming you you have only programmed in imperative languages) 2. Functional languages predict the future 3. (Functional languages are sometimes used in industry) 4. Functional languages are elegant

Functional languages in the real world Java 8 F#, C# 3.0, LINQ Scala Haskell Erlang OCaml https://ocaml.org/learn/companies.html...but Cornell CS (et al.) require functional programming for your education, not to get you a job

Albert Einstein "Education is what remains after one has forgotten everything one learned in school." 1879-1955

Why study functional programming? 1. Functional languages teach you that programming transcends programming in a language (assuming you you have only programmed in imperative languages) 2. Functional languages predict the future 3. (Functional languages are sometimes used in industry) 4. Functional languages are elegant

Elegant

Elegant Beautiful

Do aesthetics matter? YES! Who reads code? Machines Humans Elegant code is easier to read and maintain Elegant code might (not) be easier to write

OCaml A pretty good language for writing beautiful programs O = Objective, Caml=not important ML is a family of languages; originally the meta-language for a tool

OCaml is awesome because of Immutable programming Variable s values cannot destructively be changed; makes reasoning about program easier! Algebraic datatypes and pattern matching Makes definition and manipulation of complex data structures easy to express First-class functions Functions can be passed around like ordinary values Static type-checking Reduce number of run-time errors Automatic type inference No burden to write down types of every single variable Parametric polymorphism Enables construction of abstractions that work across many data types Garbage collection Automated memory management eliminates many run-time errors Modules Advanced system for structuring large systems

A GLIMPSE OF OCAML...

Languages are tools

Languages are tools There's no universally perfect tool There's no universally perfect language OCaml is good for this course because: good mix of functional & imperative features relatively easy to reason about meaning of programs But OCaml isn't perfect (see above) there will be features you miss from language X there will be annoyances based on your expectations keep an open mind, try to have fun

LOGISTICS

Course website http://www.cs.cornell.edu/courses/cs3110/2017fa/ Full syllabus (required reading) Lecture slides & notes Usually posted night before, but if not, it s because I m still writing them Supplement, do not replace, attendance Labs: practical problems for you to study and talk about in recitations

Course staff Professor: Michael Clarkson PhD 2010 Cornell University Research areas: security and programming languages I go by Prof. Clarkson in this course TAs and consultants: 45 at last count Grad TAs: Josh Acay, Kevin Chavez, Andrew Hirsch Head Consultant: Charles Jiang

Course meetings Lectures: TR 10:10-11:00 am Attendance is semi-mandatory, measured by i>clicker Go buy an i>clicker and bring it on Thursday Laptop use only in designated area please Recitations: mostly MW Attendance is semi-mandatory, measured by TAs TR sections are effectively MW delayed one day You need to attend your registered section Laptops encouraged for working problems Office hours: coverage nearly every day

Piazza Last fall: 2700+ posts

Piazza Requests from me to you: Take questions of broad interest to Piazza or to office hours Take questions of interest only to you to office hours Treat Piazza as virtual study group, not instructor hotline Answer one another s questions: bonus! Be brave: eschew anonymity Read my webpage on asking technical questions

Email Please do not send email directly to any instructors NetID, unless it s to schedule a meeting To contact anyone in charge send email to cs3110-mgmt- L@cornell.edu (= prof + grad TAs + head consultant) E.g., no one at scheduled office hours or recitation section, bad hyperlink on course website, request extension To contact me only, send email to cs3110-profs-l@cornell.edu If it s something we can handle in person after the next lecture, I probably won t reply Assume replies will take five days

Academic integrity You are bound by the Cornell Code of Academic Integrity, the CS Department Code of Academic Integrity, and the CS 1110 Explanation of Academic Integrity All linked from course website You are responsible for understanding them I use MOSS to detect plagiarism; it works If you have a question about what is or is not allowed, please ask If you fear you have committed a violation, tell me before grading commences

Your TODO list for tonight 1. read material on website linked for today: syllabus, tips for success, asking technical questions 2. buy an i>clicker 3. login to CMS 4. login to Piazza 5. install software: instructions linked on website 6. try doing the lab linked for today; bring any questions you have to recitation tomorrow

Upcoming events [Tue-Thur pm] Drop by my office in the afternoon if you need something immediately [today] Office hours start; check calendar on course website for times; consulting hours always in Rhodes 405 [Wednesday] Recitations begin (none today); bring laptop [Thursday am] bring i>clicker why are you still here? Get to work! J THIS IS 3110