CS 15-212: Principles of Programming
(Spring 2010)
|
|
Lectures: Su,Tu 16:00 - 17:20 (room 2147)
Recitations: Mo,We &16:30 - 17:20 (room 1190)
Class Webpage:
http://qatar.cmu.edu/cs/15212
Co-instructor: |
Thierry Sans
Office hours: by appointment
Office: CMU-Q 1019
Email:
|
Click on a class day to go to that particular lecture or recitation. Due
dates for homeworks are set in bold. The due date
of the next homework blinks.
This course has the purpose of introducing students who have had experience
with basic data structures and algorithms to more advanced skills, concepts
and techniques in programming and Computer Science in general. This will be
accomplished along three dimensions.
- The main skill you will get out of this course is a logical attitude
toward problem solving. You will learn how to decompose a problem into
manageable parts, how to compose their solutions into a complete program,
and how to reason about programs to ensure that they are correct
- As we do that, you will be exposed to some advanced but pervasive concepts
in Computer Science and programming. In particular, you will learn about
induction and recursion, program correctness, symbolic computation,
search, grammars and parsing, structuring large programs, computability,
continuations, streams and more
- Our vehicle for achieving these objectives will be Standard ML, one of the
most advanced experimental programming languages brewing in the labs
worldwide. SML will expose you to a programming paradigm that is totally
different from what you have seen in Java, namely functional
programming. This will give you first-hand experience with a number
of high-level programming techniques such as recursion, higher-order
functions, data abstraction, polymorphism, exceptions and modularity.
Bits and pieces are found in current commercial programming language such
as Java, and more will be part of the programming languages of the future
You must have completed CS 15-251
(Great Theoretical Ideas in Computer Science).
It is my goal to make this course successful, stimulating and enjoyable. If
at any time you feel that the course is not meeting your expectations or you
want to provide feedback on how the course is progressing for you, please
. If you would like to provide
anonymous comments, please use this feedback page or slide a note under my door.
The course relies extensively on the programming language Standard ML (SML)
and related utilities, mainly ML-Lex, ML-Yacc and Concurrent ML. The
particular implementation we will be working with is Standard ML of New Jersey (SML/NJ), version
110.70.
SML on Your Own Laptop
The most convenient way to use SML is to install a personal copy of SML/NJ on
your laptop. For Windows laptops, download this
file and follow these
instructions. If you run a different operating systems, read here.
SML at CMU-Q
A reference build has also been made available in the Unix clusters. To run
it, you need to login into your Unix account. In Windows, you do this by
firing PuTTy and specifying unix.qatar.cmu.edu as the machine
name. When the PuTTy window comes up, type sml, do your work,
and then hit CTRL-D when you are done.
You can edit your files directly under Unix (the easiest way is to run the
X-Win32 utility from Windows and then run the Emacs editor from the PuTTy
window by typing emacs - see also this tutorial).
If you want to do all this from your own laptop, you first need to install
X-Win32 from here.
PuTTy is pre-installed in Windows.
Documentation
Useful documentation can be found on the SML/NJ web site. The following files will be
particularly useful:
The 15-212 Wiki
The material for all lectures can be found on the 15-212 wiki. This is
wiki, not a textbook. The main differences are:
- It is dynamic: the content will change over time (for the better)
- It will always be work in progress
- Everybody can make updates. This means YOU!
Further References
- Michael R. Hansen and Hans Rischel, Introduction to Programming
Using SML, Addison-Wesley, 1999.
- Robert Harper, Programming in Standard ML, working draft of April
23, 2007 (version for browsing, version
for printing)
- Lawrence C. Paulson, ML for the Working
Programmer, 2nd edition, Cambridge University
Press, 1996.
Note: This book refers to an older
specification of SML and programs in it may not work in current SML
environments.
This is a 12 unit course.
- Daily homework and Participation: 15%
- At the end of the every lecture, you will be given daily
homework, a couple of simple exercises or questions collected
during the next recitation. Each will be graded, with negative points for missing or sloppy
work.
- Participation has three components:
- Class participation: volunteer to answer questions asked to the
class
- Class preparedness: you must have done the readings before coming
to class
- Involvement with the wiki: if you see an error, correct it; if you
have a better explanation for something, change it; if you see
something missing, add it
- Assignments: 60%
- 6 to 12 assignments
- 5% for 1-week assignments and 10% for 2-week assignments, for a total
of 60%
- Written and programming parts. A program is like an essay!
- Handed out on Saturdays, generally
- Due on Saturdays at 11:59pm Doha time. Submit on the Blackboard
dropbox.
- You have a total of 3 late days
- After that, late homeworks will be accepted until the beginning of
next recitation, but with a 25% penalty
- Graded by the following Sunday. Evaluated as follows:
- Programs will be evaluated based on correctness (your
program should work), specification (it should contain
structured comments describing types, meaning of
the returned value, invariants, and side-effects) and
elegance (see these notes about style)
- Essays will be evaluated on the basis of content (it
answers the question exhaustively), form (it is well
structured, grammatical, etc.) and creativity
(you are not stating the obvious)
- To encourage good work and integrity, the instructor may invite
students to his office to explain their solutions. Should this happen,
the students' explanations will become part of their grades for that
assignment.
- No joint assignments unless explicitly instructed
- Midterm exam: 10%, in class, closed books
- Final exam: 15%, 3 hours, open books and notes (but not laptops)
- Bonus points: up to 10% for
particularly elegant solutions
- Negative points: up to -100% if caught
cheating
Academic Integrity
You are expected to comply with the University Policy
on Academic Integrity and Plagiarism.
Collaboration is regulated by the whiteboard policy: you can bounce
ideas about an assignment, but when it comes to typing it down for submission,
you are on your own - no notes, snapshots, etc., you can at most reconstruct
the reasoning from memory.
Course Objectives
This course seeks to develop students who:
- can leverage the mathematical structure of a problem to develop a
solution
- can use abstraction and modularity to manage complexity
- can use formal arguments to prove the correctness of a problem
solution
- master a non-declarative programming paradigm
- have gained advanced skills, concepts and techniques in programming and
Computer Science
Learning Outcomes
Upon successful completion of this course, students will be able to:
- explain and use basic programming language
concepts such as typing, evaluation, declarations, expressions,
values, and types
- explain and use advanced programming language
concepts such as data types, pattern matching, polymorphism,
higher-order functions, continuations, exceptions, streams,
memoization, modularity, formal language hierarchy
- design recursive algorithms and develop
recursive programs
- use mathematical induction to prove program
correctness
- model problems in Computer Science using
lists, trees and graphs
- program symbolic solutions to problems using
data types and pattern matching
- use polymorphism and functional arguments to
build reusable program modules
- develop abstract and parametric modules for
code reusability
- write a grammar for a language and program a
basic parser
- recognize non-computable problems and give
formal arguments to support non-computability claims
The course is organized around the following themes:
Weeks 1-4 |
Weeks 5-7 |
Weeks 8-10 |
Weeks 11-14 |
Inductive definitions |
Functions |
Co-inductive definitions
Computability |
Languages and Computation |
In this course, there will be two types of lectures:
-
Problem solving lectures are listed below with a blue
background. They will look at Computer Science problems from a
mathematical perspective, emphasizing an abstract, logical,
understanding of problems and solutions. You will not see a single
line of code in these lectures.
Each problem solving lecture is followed by a
problem solving recitation (in light blue) dedicated to
reinforcing the introduced concepts through exercises.
-
Programming techniques lectures are listed with a green
background. They serve two purposes: first they introduce some
advanced, but language-independent, programming concepts (e.g.,
polymorphism and modularity); second they expose you to a
non-imperative programming language, currently ML. Here, we will use
the abstract problem solving techniques you have learned in the blue
lectures and the advanced programming concepts to solve real problems.
Each programming techniques lecture is
followed by a programming techniques recitation (in light
green) dedicated to reinforcing the introduced concepts through
exercises.