CMPT 383

Comparative Programming Languages

Summer 2009

 

General Information

All students in this course are responsible for reading and understanding the information in this document. If you have any questions, ask the instructor.

Students will find it useful to read their e-mail on a regular basis.

From time to time, information relating to assignments will be added to this document, but exam dates and course policies are fixed. In addition, other parts of this document may be updated from time to time, for example if office hours change or if the due date for homework is delayed. Information in green is tentative and subject to change.

The course web page is organized as a single page, making it easy to print. Fancy web features that confuse unusual browsers or slow modem downloads have been avoided. Homework assignments may be on separate web pages.


Objectives

The objective of this course is to give the student a better understanding of programming languages and their design and use.

A programming language is a notation for describing a computational process. As with mathematical notation, solving problems in very much easier if you know a good notation for describing and working with problems in your area of interest. Learning new types of notation will give you new conceptual tools.

We will be particularly interested in viewing computer programs as mathematical objects.

We will study two programming languages, Haskell and Prolog, in this course. (It is necessary to have a good understanding of more than one programming language in order to compare programming languages. Due to serious problems with the prerequisite structure of CMPT courses, some of you will have covered Haskell or Prolog in another course, while others will know only Java.)

Prolog and Haskell have been chosen because these languages and Java are based on three very different approaches to computation and hence three very different ways of thinking about computational processes.


Prerequisites

CMPT 201 or 225, and MACM 101. A minimum grade of C- is required in all prerequisite courses.

I will assume that you know Java.


Course Textbooks

Required Textbooks and Papers

The first of the required books is available in the bookstore. Other documents are available online.
  1. Programming in Haskell, Graham Hutton, Cambridge University Press 2007, ISBN: 0521692695. The web page for this book includes an Errata, Powerpoint slides, and Haskell code for each of the extended examples.
  2. Programming in Prolog: A First Course, Paul Brna, 2001.
  3. Lecture Notes on Domain Theory, Robert Muller, 1999.
  4. Monads as Containers, Cale Gibbard.

Recommended References

  1. The Haskell 98 Language and Libraries: The Revised Report, Simon Peyton Jones [editor], Lennart Augustsson, Dave Barton, Brian Boutel, Warren Burton, Joseph Fasel, Kevin Hammond, Ralf Hinze, Paul Hudak, John Hughes, Thomas Johnsson, Mark Jones, John Launchbury, Erik Meijer, John Peterson, Alastair Reid, Colin Runciman, Philip Wadler, December 2002.

Computing Resources

The official computer lab for this course is the CSIL Linux Lab (ASB 9838 Unix). The software you will need for this course is also available on CSIL machines running Solaris, and is available for free for just about every type of home computer.

We will use the Haskell and Prolog programming languages in this course. Unless I am unexpectedly inspired to try something new, the only software you will need will be implementations of these languages.

Haskell

You may use either or both of two Haskell implementations, hugs and ghc. Both are available in CSIL and both are available as free downloads.

For the most part we will be working with an interactive Haskell interpreter, either hugs or ghci (which comes with ghc). Haskell is defined to be a complied language, like C or Java, where a source program is compiled into an executable program. However, the interactive interpreters are nice for program development.

Prolog

There are numerous free versions of Prolog that will run on most home computers, including SWI-Prolog, and Gnu Prolog. It shouldn't make much difference which version you use. SWI-Prolog is availble in CSIL and will be the official Prolog implementation for this course. I may use both SWI-Prolog and Gnu Prolog in lectures (usually at random, since I always forget which advantges each has over the other). For Prolog assignments, you may use either of these, or any other Prolog implementation, but please try to avoid features that are specific to a particular implementation. (I will try to be reasonable if you accidentally use any implementation specific features.)


Instructor

The instructor for this course is Warren Burton. His phone number is 778-782-4542 and his e-mail address is burton@sfu.ca. You will be given a better e-mail address during the first lecture. This better address is a secret one given only to students and its use will usually result in your e-mail being read much sooner than otherwise.

Please include "383" in the subject of any e-mail you send. This will reduce the chances of your e-mail being overlooked or ignored. Usually, technical questions will not be answered by e-mail since these are easier to answer in face to face conversation with pencil and paper at hand. For a variety of reasons, I do not guarantee to reply to e-mail.

The TA for this course is Nasser Ghazali-Beiklar. His e-mail address is nga12@cs.sfu.ca.

I expect to be out of town for about a week sometime during the semester. While I am away, Mahdi Javadi will deliver the lectures and otherwise be in charge of the course.

Office hours are given in the table below. The TA office hours have a white background. The instructor's office hours are in blue with a yellow background.

Office Hours
Who Where Day Time
Nasser Ghazali-Beiklar TASC I 9429 A Monday 11:00-11:50
Nasser Ghazali-Beiklar TASC I 9429 A Wednesday 4:00-4:50
Nasser Ghazali-Beiklar TASC I 9429 A Friday 10:00-11:50
Warren Burton TASC I  9419 Monday 4:00-4:50
Warren Burton TASC I  9419 Wednesday 3:00-3:50
Warren Burton TASC I  9419 Friday 11:00-11:50

I have listed office hours as 50 minutes with the intention that Nasser or I can leave 10 minutes before the full hour is up if nobody is there, but the office hour will last the full hour if there is demand.  My office hours are scheduled so that I don't have anything scheduled in the following hour. Usually I will be able to run overtime if there are lots of people with questions.


Exams

There will be two exams in this course. There will be a 45 minute midterm examination in class on Friday, June 19.

The three hour final examination will start at 8:30 on Friday, August 14.

Both the midterm and the final will be open book and open note. You may use any reference produced before the start of the exam. For example, if you have a friend who takes really good notes, you may use a photocopy (produced before the start of the exam) of your friend's notes during an exam, but may not use the exam answers of the student sitting next to you (since these will have been produced after the start of the exam).

You may not use a computer, calculator or any other electronic device, except an ordinary watch, while taking any examination. Ask the instructor if you have any questions regarding these rules.

You must bring your SFU student identification card to the final examination.


Grading

The midterm will count 30% of the course grade, the programming assignments and written homework assignments together will count 10% of the course grade and the final exam will count 60%.

A scaled final examination mark may be substituted for any homework grade. See Late or Missed Assignments below.

Where appropriate, on examinations and programming assignments, clarity, simplicity and organization of your answers may be taken into consideration in grading, as well as correctness.

Missed Exams

If you miss the midterm examination and have an acceptable medical certificate then a suitably scaled final examination grade will be substituted for the midterm grade. The scaling will take into account both the averages and the standard deviations of the midterm and final. In addition, scaled marks will be constrained to be between 0% and 100%.

If you miss the final examination you must produce a suitable medical certificate. In this case, a makeup final may be given, but the basis for calculating your course grade may be different than that described here. Don't miss the final!

Late or Missed Assignments

Late assignments will not normally be accepted, even with a medical certificate.

Rather than requiring a medical certificate when a minor illness prevents you from finishing an assignment on time, I will substitute a scaled final examination mark for each missed assignment. This also allows for a number of other reasonable situations where you might not be able to finish an assignment on time. However, I do not want a student to skip handing in an assignment in the hopes that a scaled final exam mark will be better. Therefore, I will replace an assignment grade with a scaled final exam grade when doing so is to the advantage of a student. The scaling will take into account both the averages and the standard deviations of the assignment and final. In addition, scaled marks will be constrained to be between 0% and 100%.

Special arrangements may be made in exceptional cases, such as prolonged illness.

Errors in Grading

If you believe that a homework or exam question has not been graded properly, you may ask me to reconsider the grading. Corrections may result in a grade being lowered or raised.

Assignments

Reading Assignments

You should read the appropriate chapter or sections of the course text before the start of class on the day indicated in the Due Dates table below. You are responsible for all material covered in the assigned reading, whether or not it is also covered in lectures.

You are responsible for all material covered in lectures. Some lecture notes will be made available. However, reading the lecture notes may not be a satisfactory substitute for attending lectures. My lecture notes are not intended to be free standing documents. Portions of the notes will be meaningful only in the context of the lecture at which they were originally presented. Furthermore, the notes will not cover everything covered in the lectures.

Homework Problems

Homework will always be assigned at least one week before it is due. Homework will be announced by e-mail and added to the Due Dates table when it is first assigned. A problem number in parentheses in the table indicate that you should read and think about the problem, but do not need to solve the problem. Homework problems in bold and red should be handed in on the date indicated. Homework problems in black should be done, but do not need to be handed in and will not be graded. Feel free to work with others on the problems in black if you find you can learn more that way.

Homework will be collected at the start of class on the day it is due. Homework should be submitted using the CSIL Submit Server. (Note: The CSIL Submit Server is part of the CSIL GradeBook system. However, we will not use GradeBook for reporting grades in this course.)

Format of Submitted Work

In the case of a programming assignment, you should submit:

  1. The source code that you have written. This will normally include all the necessary documentation, in the form of comments. It is prefered that all the source code be within a single file, but it may be split up if necessary.
  2. Any additional documentation that you think is necessary or appropriate (usually none).
  3. A listing of any data files you have used (often none).
  4. A listing of your program output for the test cases you have run. Normally this will be a text file, but it may consist of screen shots if appropriate. If test cases are not given with the assignment, then you are responsible for constructing a suitable collection of data sets to test that your program works correctly in all reasonable cases.
  5. Any additional comment that you wish to include (usually none).

In addition, you must keep a copy of your source code until after you receive your final grade in the course. In some cases you may be asked to e-mail it to the course instructor.

Getting Help from Others

The primary purpose of the assignments is teaching rather than evaluation. Students can often learn by discussing problems with other students.

You may discuss assigned bold and red problems with other students, but must write your own solutions. As a rule of thumb, you should not leave a discussion on a specific assigned problem with anything in writing. (Throw away any notes you make during the discussion. If you understand it, you should be able to carry away what you have learned in your head.) If you received help of this form from anybody other than the course instructor, you must include an acknowledgment in your homework. You will still receive the same amount of credit for your assignment. If you are unsure whether you have violated these rules, state exactly what you have done. If you honestly state, "I paid my friend $20 to write this assignment for me", then you will not be charged with cheating, although you will probably receive a mark of zero on the assignment.

Due Dates
Date Read Chapter or Exam Hand in Problems or Note

May 4

 

 

May 6

Hutton: Chapter 1

 

May 8

Hutton: Chapter 2

Hutton: All Problems in Chapter 1

May 11

Hutton: Chapter 3

Hutton: All Problems in Chapter 2

May 13

Hutton: Chapter 4

Hutton: All Problems in Chapter 3

May 15

 

Hutton: All Problems in Chapter 4

May 20

Hutton: Chapter 5

 

May 22

Hutton: Chapter 6

Hutton: All Problems in Chapter 5

May 25

Hutton: Chapter 7

Hutton: All Problems in Chapter 6

May 27

 

Hutton: All Problems in Chapter 7

May 29

Prolog: Chapters 1-6

Assignment 1

June 1

 

 

June 3

 

 

June 5

 

 

June 8

 

 

June 10

 

 

June 12

Hutton: Chapter 8

 

June 15

Hutton: Chapter 9

Assignment 2

June 17

 

 

June 19

Midterm

 

June 22

Hutton: Chapter 10

Assignment 2
Hutton: All Problems in Chapter 8

June 24

 

Hutton: All Problems in Chapter 9

June 26

Pages 1-5 of Muller

Hutton: All Problems in Chapter 10

June 29

 

 

July 3

Monads as Containers

 

July 6

Prolog: Chapter 7

Assignment 3

July 8

Prolog: Chapter 8

 

July 10

 

 

July 13

Hutton: Chapter 11

 

July 15

Hutton: Chapter 12

 

July 17

Hutton: Chapter 13

Hutton: All Problems in Chapter 11

July 20

 

Hutton: All Problems in Chapter 12

July 22

Prolog: Chapter 9

Hutton: All Problems in Chapter 13

July 24

Prolog: Chapter 10

 

July 27

Prolog: Chapter 11

 

July 29

Prolog: Chapter 12

 

July 31

 

Assignment 4

August 14
8:30-11:30 am

Final Examination in AQ 3181

 


Academic Honesty

Honesty plays a key role in our efforts to maintain a high standard of academic excellence and integrity. Students are advised that all acts of intellectual dishonesty are subject to disciplinary action by the School and that serious infractions will be referred to the President for further sanctions. Students are encouraged to obtain a copy of the School's Statement on Intellectual Honesty.

Most semesters somebody forgets to acknowledge help they have received help on a homework assignment. This is considered intellectual dishonesty. Please save us both some trouble and unpleasantness, and acknowledge all help.