CSE 222 Lab #2
Objectives
-
Familiarity with designing and coding a realistic component-based application
program without being provided a skeleton solution.
The Problem
Your customer, Cy Burnett, heads a major publisher of textbooks who is
migrating toward on-line access. Cy wants a relatively easy-to-maintain
glossary
facility. (A glossary is a list of difficult or specialized words, or terms,
with their definitions, that is usually near the end of a book.)
His initial requirements are as follows:
-
The output shall be either a single HTML file or a group of HTML files.
There shall be a top-level index which merely lists each term in the glossary,
and a separate listing of the terms with their definitions. Clicking on
a term in the index shall take you to that term and its associated definition.
Moreover, clicking on any term in the glossary that happens to appear in
a definition shall take you to that term and its associated definition.
-
Every term shall consist of a single "word" (i.e., a term contains no whitespace
characters).
-
The terms shall appear in the glossary index in alphabetical order. The
definitions of terms, if they are included in a single HTML file, shall
be listed in alphabetical order by term. In the list of definitions, each
term shall appear in red boldface italics
just before its definition.
-
The entire glossary shall be generated in batch fashion by your program,
from input on stdin. This input shall consist of a single term on the first
line, its definition on the next one or more lines (terminated by an empty
line), another term on the next line, its definition on the next one or
more lines (terminated by an empty line), etc. The input shall continue
in this fashion through the definition of the last term, which shall end
with its terminating empty line. The program shall not check for invalid
input; the customer shall be responsible for providing input that meets
the stated conditions.
These are the stated requirements for your program. If you have questions
of clarification or need additional details, Cy is willing to answer them
if you ask your instructor to contact him.
Method
Here's what to do:
-
There are no skeleton files; this is the "blank sheet of paper" lab
that you've all been waiting for!
-
When you are satisfied that your program works, get into your Lab02 directory in an xterm window
and use the submit command to submit your solution as follows (noting
that you will need to use the appropriate suffix in place of ?? in
this command, as posted next to your instructor's name on the CSE 222 Home Page):
submit c222?? lab2 *
If you get an error message rather than a confirmation of success,
please read the message; it contains useful information! Do not just
run the same command again. Save the e-mail you get as a receipt of
submission, just in case.
Your grade will depend not merely on whether the final program meets the
customer's initial requirements, of course, but also on the general software
quality factors we've been discussing for the past half-year: understandability,
precision, appropriate use of existing software components, maintainability,
adherence to coding standards, and so forth.
A sample input file is available at:
/class/sce/now/222/labs/lab02/Lab02/terms.txt
A sample of program output for a glossary done as a single HTML file is
available at:
/class/sce/now/222/labs/lab02/Lab02/version1/index.html
A sample of program output for a glossary done as several HTML files is
available at:
/class/sce/now/222/labs/lab02/Lab02/version2/index.html
You should not assume that your glossary must look like one
of these, which are merely samples of what the output might be. The samples
are just something your requirements analyst and the customer cobbled together by hand for a small glossary,
to serve as possible prototypes for the final program output. You should
feel free to improve on them.
Possible Maintenance Activities
Here are some questions about possible maintenance activities involving
this program:
-
What happens if a definition provided in the input includes HTML tags?
- What happens if a term occurs, within a definition, in its plural form?
Fix the program so it handles such a case "correctly", i.e., so it introduces
a link from that term.
-
Modify the program to handle multiple-word terms.
-
Modify the input format and the program so there can be multiple indexes.
In particular, allow each term to have not only a definition but a set
of other indexes in which it should appear, in addition to the alphabetical
master index.
-
Write a more professional instruction manual (e.g., as an HTML document
or using a word processor).
Any extra work is strictly optional, for your own benefit, and will not
directly affect your grade.