1 Goal
2 Choosing a Language
3 "Hello, World!"
4 Program Requirements
5 Handin

Assignment 7, CSC430, Winter 2011

1 Goal

This assignment asks you to write a web program. At this point in the course, the purpose of this assignment seems unclear. Once the assignment has been handed in, however, we’ll introduce an entirely new way of programming the web which is intimately linked with one of the fundamental ideas of programming languages. By completing this assignment now, you’ll be better prepared to appreciate this idea when we introduce it in class.

Though this assignment should not take you very long, we are giving you a full week because we know that not everyone is familiar with web programming; you may need to do some learning on your own. Futhermore, to avoid last-minute problems, this project has an early "Hello, World!" hand-in in which you must demonstrate you have a web programming environment set up.

2 Choosing a Language

Unlike the other programming assignments in the course, in this one you will be able to use a programming language of your choice. If you’re already familiar with web programming, choose a language that you’re comfortable with. If you’re not, the web is a font of meta-information, so you should have little trouble in finding resources about programming for it.

For example, your web program may run as:

A CGI script. CGI stands for "Common Gateway Interface" and is the simplest web-programming protocol. You may run CGI programs on the department’s www server by creating a "www" subdirectory within your home directory (if you don’t already have one) and then creating a soft link to it named "public_html", like this:

  ln -s www public_html

You can then put executable files with a ".cgi" extension in your web directory and execute them by visiting the corresponding URL in a web browser. We recommend using CGI if you have never programmed a web application before.

A PHP script. You may use PHP, if you are familiar with it.

A Java servlet. Finally, if you have used Java servlets before, you may use them for this assignment. However, I have no idea whether the department’s server supports java servlets; most apache installations do not. If you go this route, you will probably have to host the servlet on your own machine.

3 "Hello, World!"

We want you to get your web programming setup sorted out early. You must demonstrate that you have by creating a "hello, world!" web application. The application should show a web page with the text "hello, world!" and the current time and date.

We won’t require a formal handin for this. Instead, e-mail the newsgroup with the URL of your application and what language/environment you’re using. You must send this e-mail by 11 PM on Friday, February 25.

4 Program Requirements

You will implement a simple short-answer test-taking tool. Although this program is quite simple, it is representative of the core of much larger Web software (just as the interpreters we write in this course are themselves quite lean, but represent the core of large programming languages).

This tool should allow a user to take a test consisting of at least six questions. The webpage should start by displaying one question, and providing a box for the answer. After the taker fills in the box and clicks "next", the system provides the next question.

At the end of the questions in the test, the taker should see a list of his or her answers, along with individual marks showing which answers were correct and which were incorrect. Also, the page should display the fraction of users that have gotten each question correct over the lifetime of the servlet.

Note that all taker answers should be regarded as plain, ASCII-encoded text. In particular, this means that your software will need to escape HTML entities and tags. For example, typing "<b>" into a text field should not make any part of the results page bold.

We do not require that you save test statistics to disk, but you may need to, depending on your choice of web application environment. You do not need to worry about concurrent accesses (i.e. you need not lock any data files).

5 Handin

This will be a pair programming assignment. For this assignment, choose a partner that you did not work with on the last programming assignment. Both team members should send me e-mail on or before Friday, informing me of your choice of partner.

One team member should hand in the assignment. For this assignment, we will use the handin program. You can run it on any of the Linux machines, by running

  /usr/bin/handin clements CSC430-P7 <file> ...

Include all of the source code. Also, include a README file containing the names of the members of the group and the URL where the web application is running.