Site Design and On-line Polling Application.
On-line polls are a simple way to involve visitors in the content of
a web site. Although they are not scientific, they provide some sense
your visitors feel about a topic and people like to express their
opinions. It doesn't hurt that they can be entertaining. In this first
programming project, you will build a simple on-line polling
This first project is part of a larger process of not only learning
about web programming but thinking about the representation of information
a web site and the generation of dynamic content. The poll application
will also be incorporated into your final web site so you are building
As a matter of fact, your poll must be embedded in a mock-up of
your E-Commerce page.
This application is data-driven. You are probably accustomed to writing
subroutines that are parameter-driven or applications that are data-driven.
Here, the data comes from external sources: another computer (browser)
via another process (web server) or from files. Users pick which poll
they are interested in, whether they want to cast a vote or just look
The choice of polls and data about each individual poll are stored in
external files so adding, changing or deleting a poll requires no modification
to your code.
There are three basic
forms of data that
you need to
store in text files on your
a poll consists of a question and several user choices
(responses) - these are .poll files.
- User response data: How users
are voting on each question (this data can be part of the .poll
file, too or as a separate .dat file for each poll.
file: a single file that you will use to simplify administration
polling application - this is a poll.config file. It contains
a list of polls.
Here is a sample poll. Try it out.
Nuts and bolts:
- Create a sub-directory in your pfw directory on vega called project1 (all
directory names must be lowercase) in which you can place this assignment's
goes in there.
The specific requirements for the project are listed
- Design a front page to your E-Commerce site. (Most of it will be static for now.) Your E-Commerce site will be an information/commercial site
about a topic of your choosing.
Your home page must include a recognizable photo of
yourself integrated into the design. The site will eventually include the following things, so they should
be part of the design:
- News Feeds
- SOAP Services (You can relabel this section later in the quarter when you choose your services.)
- Your poll must be part of your mock-up of your
web site (even if our example is not :-) )
- You must give the user a choice of at least three
polls as a starting point. This list is generated dynamically from
the contents of the config file, so if your application is well-written,
any number of polls and your program would require no modification.
The list of polls is maintained
in the configuration file.
- Polls can have as many as 5 responses to the question to choose from
or as few as two. This is actually arbitrary; a well-written program
will handle as many choices as you throw at it and thinking about this
as dynamic is a better way to begin.
- Adding new polls and changing the polls requires
no modification to the scripts. Just make a new file with the
question and responses
in it and add the poll to a configuration file (which is basically
a list of polls). Poll files should be called <filename>.poll (like,
bush.poll) so they are easy to recognize (by humans and programs).
- The configuration file must be called polls.config.
It contains a list of polls (the base name would be easier) and,
the poll is active or not (can you enter you opinion or is voting over
and you can just see the results).
- The data for each poll can be stored either in the .poll file or
in a separate <filename>.dat file (like, bush.dat).
- Put all of your external data files in a subdirectory called polldata.
- All external files should be human-readable text files. Using a table
metaphor, each line in the file is a row in the table. Use tab characters
to delimit the data on a line (make the columns in the table).
- When users vote in a poll, they get immediate feedback
showing the current results of the poll. The output will state how
many votes were cast for each choice and the total number of votes
count and then add a percentage for each choice as well. As time permits,
add a graphic representation (bar graph).
- Use the GET method for input from the browser to the program
so that the parameters passed to your scripts are visible to me.
- Use file locking to maintain the integrity of the count of votes (we
don't want any voting irregularities in our polling places!).
- Modularize your code to abstract getting and saving data from external
sources. For example, you can put the information about a poll into
an array to use it to generate a web page to vote. How it got into
the array and where it came from should be unnecessary information
- Submit your scripts (.php pages) and your config, an example of your
.poll files and .dat files as an attachment to a note posted in your
section of the course's subconference for
did any extras or you need
explain anything about what you did, please put it in this note. This
subconference will be set up as a drop box so you can submit work but
won't be able to delete what you submit or look at other students submissions.
You can resubmit, however.
Here are a few things that you can do to enhance the assignment (to
get an A on the project, you must exceed the basic requirements in
some significant way) as examples:
- Extend the config.poll file format so that it includes a start and
end date for a poll so that you can have current polls in which users
can vote and prior polls that have expired for which users can only
- Provide a supplemental capability for creating a new poll (the
text file that contains the question and choices, a new data file for
accumulating voting results), and a new entry in the config fle. This
capability must be password protected; only someone with a valid username
and password can create a new poll. You may assign new usernames and passwords
manually (add them to a file of users and passwords). If
do this option, you must include my password (my username
is dsb) in your submission e-mail (not in an archived readme file) so that I can test your program.
- Make an administrative interface to make it easy to add new polls,
delete/close polls and modify polls.
The most essential element of the project is scripts
that work properly and functionality that matches the requirements stated
- 75%: It works
- Basic functionality described above
- Robustness and error-handling
- Proper installation
- Data file format
- 15% Code quality
- Code structure and documentation including effective software
design principles such as modularity, defining reusable functions,
function cohesion (functions/subroutines have a single clearly
defined purpose) and minimal coupling (no unnecessary use of
proper parameters to avoid unintended side-effects).
- 10% Web site mock-up
- Mock-up design
- Poll is integrated into design
Due date: Due Sunday, October 2nd, 8:00 p.m. 10% per day late.
Nothing accepted after Sunday, October 9th, 8:00 p.m. without explicit permission
from your professor.