Homework #1 CMSC 131
Due February 6, 2003 Object-Oriented Programming I
  Spring 2004

 

Homework Goals:

Please read through the course information on the web, and in particular the collaboration policy. For this assignment, you will work with an assigned partner, and you are encouraged to actually do the project together (rather than splitting it up and each doing part).

We would also like to track how much time you are spending on various parts of this course. To that end, we require that you keep a log of when you work on each homework. For pair assignments (like this one), each student must submit this information separately. In addition to the files you submit for your assignment, each student must submit a log that follows the format described at the end of this assignment.

This assignment has three parts, and will be graded as follows:

Part 1 - Program Design

In this assignment, you should pretend that you are corresponding with a Martian pen pal. (Alternately, pretend you're corresponding with your professor, which can often feel the same.)

Pick a system of some sort that you encounter in every day life and describe/explain it to your pen pal. You may choose any physical system, like a vending machine or a pinball game, or an organizational system such as the UMD Computer Science Department. (But don't pick a bank or a coffee machine, as those are described in the article referenced below.) Your job is to explain this system to your pen pal. You should write your description online in your choice text editor or word processor, and should fill in the template that follows this description. You should consider the following:

1. What kinds of users does this system have, and what different needs might this system fulfill for each of them? (The same person may use the system for different purposes at different times. Each of these potentially defines a different kind of interaction.) For each user interaction (i.e., use case), describe the prerequisites, the interaction, and the effects.

2. What are the constituent parts of the system? For each one, give its name and a brief description of its purpose, function, or responsibility. Describe the services that it offers, and anything that the component needs to keep track of.

3. How do these parts interrelate (and relate to users outside the system)? What interaction paths exist, and what kinds of transactions or information flow happen over these paths?

The use cases and scripts for the library example in the second chapter of the assigned reading from CS101.org is a good model for this assignment, although you are not expected to implement the methods/services as is done in later parts of that chapter. A different description of this process, can found in Alistair Cockburn's coffee machine scenario.

Remember that Martians (and Professors) know very little about life on Earth, so you should make your description fairly detailed and specific. The description (including use cases, component specifications, and scenarios) need not be more than one page (total), and in no circumstances should it exceed three pages. (Martians have notoriously short attention spans.) It should also be well written and reasonably easy to read. (Martians know a good writing consultant.)

Name 1
Student ID 1
Name 2
Student ID 2
Homework #1

Name of system to be described, with brief high level description of what it is.

For each of 3 users, describe a use case:

USE CASE #

  • Prerequisites: what must be true for the use case to arise
  • Set of possible actions and interactions, perhaps described in
    terms of conditionals and loops
  • Effects: what changes are made to the computational system and
    to the user as a result

For each part of the system:

PART #

  • Name and description
  • Services it offers
  • What the part must keep track of

For each interaction between parts:

INTERACTION #

  • Describe related parts and interaction
  • What information is shared through this interaction

Write-up Template

Part 2 - Unix and Java

1. Classify each of the following as either hardware or software:

a. the Java compiler
b. the computer's CPU
c. the Java Virtual Machine (JVM)
d. the JVM when embedded in a cell phone
e. a cell phone

2. Log onto your Unix class account, and try the following commands, and then answer the following questions. All Unix commands are indicated by a bulleted list. General instructions start with '=>'.

a. What is the difference in output between the previous two ls commands?

b. What is the line of output from the above ls command that contains the word 'foo'?

c. What is the output of the 'cat' command above?

d. What is the option to the 'rm' command that will make rm recursively remove directories and subdirectories?  Hint - use the 'man' command to figure it out.

e. What is the core difference between the 'less' and 'more' commands?

f. You have two files 'foo' and 'bar' in your current directory. Write a sequence of commands after which 'foo' will have the contents 'bar' used to have, and 'bar' will have the contents 'foo' used to have.

g. If you have gotten yourself lost, how do you find out what directory you are currently in?

h. How do you return to your home directory?

3. Download the source code for the program JavaEyes.java, and save it as "JavaEyes.java". Note that the capitalization is important. Compile and run the program.

If you are logging into a Unix machine remotely, then this program will only work properly if you are running from a machine that is an "X Server".  Most Unix machines are.  Most Windows and Macintosh machines aren't.  In addition, you must log into the remote Unix machine in a way that tells the remote Unix system how to display graphics on the X Server you are sitting at.  The simplest way to do this is to initially log into the remote system from the system you are at using the command "ssh -X wam.umd.edu".  (The -X option tells the remote machine to send graphics back to the machine you are sitting at.)

On WAM Unix machines, you must first enable Java by entering the command "tap java141".  Then, try these commands:

a. What does the JavaEyes program do?

b. Edit JavaEyes.java with your favorite editor and change the line that contains "Color.black" to "Color.red". Rerun JavaEyes, and describe what the difference is in the program.

If you don't know how to use an editor on Unix, then you should use pico - a simple editor that is pretty easy to get started with.  To use it, just enter 'pico' from a Unix command line.  Note the list of controlkey options at the bottom of the screen.  Press Control-G to get help about using Pico.

c. Edit JavaEyes.java and change the line that says:

physics = ATTRACTION;

to

physics = REPULSION;

Rerun JavaEyes, and describe what the difference is this time.

Part 3 - Wiki

You must visit the class "wiki", a collaborative website we will use for this class where *everyone* can post information and respond to each other.  For now, you must create a page for yourself in the appropriate section.  Read the help (see bottom link on navigation bar on the left) within the wiki to learn how to use it.

Time Log

In addition, each student must turn in a separate time log that you must keep during the week as you work on this class. You will not be graded on the content of this log, only by its existence.  But it will help us to understand how the class is going and where there are trouble spots if you fill it out accurately as you work (and not after the fact).

Name
Student ID
Homework #1 Time Log

Date, task, # hours
Date, task, # hours
Date, task, # hours
Date, task, # hours
...
Comments
<comments here>

--------------

For each session of work outside of class, put one entry in the log.  For the task, put one of:

  • reading
  • homework
  • other

If you have any comments about your experience working in pairs, feel free to let us know in the optional comments section.

Time Log

Turning in your assignment

For this assignment, turn in parts 1 and 2 on paper with both student's names and IDs AND section numbers.  All assignments must be typed using a text editing system of your choice. One time log should be turned in for each student, and they should be done separately and privately.

This first assignment should be turned in at the *beginning* of your lecture on Friday.  No late homeworks will be accepted. All future homeworks will be due Tuesday at 6pm.


Part 1 of this homework is derived from Lynn Stein's www.cs101.org project 0.