Docsity

CS 3110: Data Structures and Functional Programming - Course Overview, Summaries of Data Structures and Algorithms

Partial preview of the text

Download CS 3110: Data Structures and Functional Programming - Course Overview and more Summaries Data Structures and Algorithms in PDF only on Docsity!

http://www.flickr.com/photos/rofi/2097239111/

Data Structures

and

Functional

Programming

Course Overview

Nate Foster and Michael George

Cornell University

Spring 2014

Course staf

l Instructor: Nate Foster l Joined Cornell in 2010 from Upenn l Research area: programming languages l Instructor: Michael George l Joined Cornell in 2013 from Cornell l Research area: programming languages TAs: Jonathan DiLorenzo, Ben Greenman, Ben Carriel, Muhammad Khan, Arjun Biddanda, Jianneng Li, Harris Karsch l

10 person-years on 3110 course staf Consultants: many

Course web site

http://www.cs.cornell.edu/Courses/cs

  • Course material
  • Homework
  • Announcements Includes a complete set of course notes  Nearest equivalent to a textbook  But the lectures and sections are definitive Links to lecture notes will go live shortly after lecture Goal is to help, not replace attendance!

Piazza and CMS

 Online discussion forum  Monitored by TAs/consultants  Ask for help, but don’t post solutions CMS  “Course Management System”  Assignments and grades posted here

Grading

Rough breakdown:

  • 45% problem sets
    • automatic grading for correctness
    • manual grading for design
  • 30% prelims
  • 20% final
  • 5% participation (lecture, section, piazza,...) We expect the median grade to be in the B/B+ range.

Karma

This material is fun and interesting

  • You are encouraged to explore on your own
  • We'll give you suggestions for things to try
  • But come up with your own too! But...Karma is completely optional and will not afect your grade

Academic integrity

Two requests:

  1. You are here as part of an academic community. Act with integrity.
  2. If you aren't sure whether some type of collaboration is allowed, ask! ...and one note: We use automated software to detect cheating. It works.

Special Needs and Wellness

We will provide reasonable accommodations to students who have a documented disability (e.g., physical, learning, psychiatric, vision, hearing, or systemic). If you are experiencing undue personal or academic stress at any time during the semester (or if you notice that a fellow student is), contact me, Engineering Advising, or Gannett.

Thinking versus typing

“A year at the lab bench saves an hour at the library” Fact: there are an infinite number of incorrect programs Corollary: making random tweaks to your code is unlikely to help

  • (^) If you find yourself changing “<“ to “<=“ in the hopes that your code will work, you’re in trouble Lesson: think before you type! http://www.flickr.com/photos/tmartin/ 732/

CS 3110 Challenges

In early courses smart students can get away with bad habits  “Just hack until it works”  Solve everything by yourself  Write first, test later CS 3110 ≈ Tour de France  Professionals need good work habits and the right approach Will need to think rigorously about programs and their models  Think for a few minutes, instead of typing for days! http://www.flickr.com/photos/franklintello/ 205547/

Main goal of CS

Master key linguistic abstractions:

  • Procedural abstraction
  • Control: iteration, recursion, pattern matching, laziness, exceptions, events
  • Encapsulation: closures, ADTs
  • Parameterization: higher-order procedures, modules Mostly in service to rule # Transcends individual programming languages

Other goals

Exposure to software engineering techniques:

  • Modular design
  • Integrated testing
  • Code reviews Exposure to abstract models:

Models for design & communication

Models & techniques for proving correctness

Models for analyzing space & time Rigorous thinking about programs!

Proofs, like in high school geometry

Why OCaml?

OCaml programs are easy to reason about

  • variables don't change
  • function output depends only on input
  • well defined semantics OCaml makes abstraction easy
  • polymorphism
  • higher-order functions
  • modules OCaml is safe
  • many errors caught early
  • “once it compiles, it's probably right”

Imperative style

Program uses commands (a.k.a statements ) that do things to the state of the system:

  • x = x + 1;
  • a[i] = 42;
  • p.next = p.next.next; Functions and methods can have side efects

int wheels(Vehicle v) { l v.size++; l return v.numw;

}