Sample Project
CISC 323, winter 2004

This is a sample project which parallels the tasks set for Assignment 3, 4 and 5. This year is the first year we've done a project in CISC 323, so we can't point you to projects from previous years as examples. Instead, we've created a parallel project to serve a similar function. We hope it will answer many of your questions about exactly what we want.

This page now contains a complete sample project, including implementation.

Initial Problem Description: You're working for a company that has decided to create and market a tool to administer simple quizzes using computers. The intended customers are students and teachers at all levels. The intention is to use the quizzes informally, as a tool for review, not for evaluation. Unlike WebCT quizzes, there will be no provisions for security (passwords, etc.).

The teacher (or perhaps a student) would use the program to create or edit a file of questions. The student would load the file and take the quiz. The program would ask each question and then report on the results at the end of the quiz. It would also give the student the opportunity to repeat the questions that he or she had answered incorrectly.

Preliminary Task: Questions and Answers: Here is a list of questions that you might ask about this problem description to nail down the specifics of what the program needs to do. The answers are phrased as if they were written by the someone in the marketing division of your company, who is responsible for deciding on the functionality of this new program.

Analysis Task 1: Use Cases  diagram     explanations

Analysis Task 2: Activity diagrams

Design Tasks: In the instructions for Assignment 4, we said that when you're doing your design you may find things you wish you could change in your analysis, and that you should supply a list of these. I made one such change and will explain it here.

As I designed my GUI dialogs for this sample project, I realized that I'd like to re-organize my use case diagram. It has editing a question divided into editing the question text, editing the correct answer, and two more options relating only to multiple-choice questions. I decided that it felt more natural instead to have one dialog for each of the three question types, in which the user could change all aspects of a question. So I wish I'd divided my "modify question" use case into "modify true/false question", "modify short answer question" and "modify multiple choice question". My fourth activity diagram would need to be changed accordingly.

My design is written as if I'd made these changes in my analysis tasks. Without this note, a grader would be justified in making a small deduction because my design is not splitting up editing tasks in the same way as my analysis.

Design Task 1: Overall Class Diagram

Design Tasks 2&3: Individual Class Diagrams & GUI Pictures

Design Task 4: Sequence Diagram for editing a true/false question

Design Task 5: Activity Diagrams
I chose to draw an activity diagram for reading a quiz -- the readQuiz method from the QuizIO class. I found it difficult to fit a diagram onto one page, so I broke it up into two pieces. The blue activity on the first diagram is expanded in a second diagram.
main diagram     diagram for "read rest of multiple choice question"
I left out some details about what's involved in reading a line from the quiz file, again to keep the size of the diagrams reasonable. The method should have a line number variable that is initialized to zero. Every time an activity says "read next line" it means the method should do the following: Every exception message should include the line number, to help the user find the error in the file.

Implementation: I have implemented this design, making a few changes along the way. First of all, here is the program: QuizProgram.zip. You may download it and look at the code and run it. That's all I would have been required to hand in.

Comments About the GUI: This is a fairly "quick-and-dirty" GUI. It's clear and functional, but it's not fancy. I used only the default colours and fonts. Some of the frames and dialogs don't look great when you stretch them. In the dialogs dealing with multiple-choice questions I left spaces rather than adding and deleting components from the layout. You may do the same in your implementations. There are no points for prettiness.

Comment About Error-Handling: I tend to have a rather paranoid style of programming, meaning that I check for errors that really shouldn't happen. I know I have some redundant error-checking in the program; for example, when you ask for one of the choices for a multiple-choice question, the getChoice method checks the index to make sure it's in range. The GUI always gets that index from a list selection or from a carefully-written loop, so this error should never happen. I like to check for things like this because it helps me track down problems when debugging. It turns out that when I was implementing the EditMCQuestionDialog I got one of these exceptions and because my exception told me exactly what had happened it was pretty easy to track down the bug in the dialog class which had triggered it. Without that check, my program would have crashed and given me much less help in finding and fixing my bug.

This is the way I like to program. We encourage you to think carefully about error checking, but you don't have to be as paranoid as I am. What matters is that your program works correctly, even in the face of user errors. For example, my design has restricted the number of choices for a multiple-choice question to 10 or less. If the user attempts to add an 11th choice, the program pops up an error message and does nothing. Your program shouldn't crash no matter what the user does.

Notes About the Implementation: As I implemented my design, I had to make a few additions and changes. As requested for Assignment 5, rather than going back and changing my design, I'm listing here the changes I would make. Remember that you don't have to list methods and attributes you added, but you must list deletions and changes in parameters. Order of Implementation: I used an evolutionary approach to implement this program. To provide you with a concrete example of this kind of approach, here is a description of the order in which I implemented the program. This order isn't the only order I could have chosen, but it worked well.

Last modified: