Project 0, The Story Game

Due: Tuesday, September 17, 11:59pm


Objectives

  1. To make sure that each student is able to submit projects using shared directories.
  2. To provide some experience with version control systems.

Background

Utilities such as CVS, SVN and GIT are important and necessary tools when you work in a large software projects with multiple programmers. These utilities facilitate collaboration and version control. However, these are not desirable features in a system used to manage project submission in a course like ours, since, for example, we do not want students to collaborate on their programming assignments. Thus, we will not be using CVS or SVN or GIT for project submission this semester.

Instead, we will practice using CVS just for Project 0. Each section of the course will participate in a collaborative effort to write a story. This is the familiar "story game" in which each person adds one or two sentences to a story --- except we will do this in Java.


Assignment

  1. First, read the Project Submission page and set up your GL account with the shared directory for this class.

  2. If you skipped the first step, just log into GL and type
    ln -s /afs/umbc.edu/users/c/h/chang/pub/cs341/userid ~/cs341proj
    
    where userid should be replaced by your username. This assumes you do not already have a file or directory named cs341proj.

  3. Next, checkout the current version of the story from your section's CVS repository. In your home directory, type in one of the following (depending on your section):
    cvs -d /afs/umbc.edu/users/c/h/chang/pub/cs341proj0/sec1 checkout -d myproj0 .
    cvs -d /afs/umbc.edu/users/c/h/chang/pub/cs341proj0/sec2 checkout -d myproj0 .
    cvs -d /afs/umbc.edu/users/c/h/chang/pub/cs341proj0/sec3 checkout -d myproj0 .
    cvs -d /afs/umbc.edu/users/c/h/chang/pub/cs341proj0/sec4 checkout -d myproj0 .
    
    Note that the period '.' at the end is necessary. This copies the files in the CVS repository to a directory named myproj0 in your home directory.

  4. Compile and run the current version of the program.
    cd myproj0
    ant
    ant run
    
    The Java program should print out the beginning of the story plus any lines that other students in your section added.

    The stories for the sections begins with:

    Section 1:
    It was a dark a stormy night. The ninja approached his target carefully. 
    
    Section 2:
    They say that everything must start somewhere. That is, unless you have a time machine, 
    then it gets all wibbly wobbly. 
    
    Section 3:
    Long long time ago, in a galaxy far far away, a dragon woke from a long slumber.
    SOMEONE took the saying "Don't poke the bear" too literally and did not understand 
    that it refers to more than just bears.
    
    Section 4:
    Once upon a time in a farwawy castle lived a robot. 
    The robot had a special task --- if only he could remember what that task was. 
    

  5. Add another sentence or two to the story. First, go to the directory with the source code and look at the Java files.
    cd src/story
    ls
    

    You should see files named Story0.java, Story1.java, Story2.java ... Each file, of course, contains the code for the corresponding Java class. Each StoryXX class prints out one or two sentences of the story in its printStoryLine() method. The Story(i+1) class literally extends the Storyi class. The previous lines of the story are printed by invoking:

    super.printStoryLine() ;
    

    Add another sentence to the story by creating a new StoryXX class that extends the last StoryXX class. You will also need to modify the main program in Recount.java to make it invoke printStoryLine() in your StoryXX class (and not the previous one).

  6. Check your program. Go back to the top level of the project, compile and run your program. Make sure that your addition gets printed:
    cd ../..
    ant
    ant run
    

  7. Check in your changes to the story to the CVS repository:
    cvs add src/story/StoryXX.java
    cvs commit -m "Submitted by John Doe." 
    
    Of course, replace the XX in StoryXX.java with the real name of the file you added and "John Doe" with your own name.

  8. CVS might say that you have a conflict. That means another student in your section added the next sentence to the story while you were busy thinking up something clever to say. To fix this, you have to:
    • Rename your StoryXX.java file something else temporarily.
    • Update the program from the CVS repository:
      cvs update
      cvs update
      
      (Yes, do it twice, the first time CVS will complain that your StoryXX.java file disappeared.)
    • Re-compile and run the latest version of the story.
    • Rewrite your sentence to fit with this latest version.
    • Rename your StoryXX.java file. Modify it so that it extends the right class.
    • Modify Recount.java again.
    • Check-in your changes to the CVS repository again:
      cd ~/myproj0
      cvs add src/story/StoryXX.java
      cvs commit -m "Submitted by John Doe." 
      
      Remember to use the new file name for StoryXX.java.
    • Cross your fingers and hope that there is no conflict this time. Otherwise, you have to repeat this step again.

  9. Submit your program for grading. (Recall that we are NOT using CVS for project submission.) Copy your files to the shared directory for Project 0:
    cd ~/myproj0
    cp -r build.xml src ~/cs341proj/proj0/
    

  10. Check your submission. Go to the shared directory for Project 0 and make sure that your program runs correctly there:
    cd ~/cs341proj/proj0
    ant
    ant run
    

  11. Clean up your submission:
    ant clean 
    

  12. That's it. You're done. You can check the progress of the story at any time by:
    cd ~/myproj0
    cvs update
    ant
    ant run
    

Implementation Notes