CS 151

Cay S. Horstmann
Lecture 2
- Pre-class reading: Section 2.1, Section 2.12 intro and subsection 2.12.1
- Clicker questions
- Put your answer into Piazza
- Counts as participation
- Lab
- Discussion
Lecture 2 Clicker Question 1
Which of the following is not a phase of the software development process described in Section 2.1?
- The analysis phase
- The design phase
- The implementation phase
- The testing phase
Lecture 2 Clicker Question 2
Which of the following is not a goal of the design phase?
- Identify classes
- Identify packages
- Identify methods
- Identify class relationships
Lecture 2 Clicker Question 3
How does a voice mail user delete messages in the application described in Section 2.10.1?
- Messages are automatically deleted after listening to them
- By selecting the 3 key after listening to a message
- By selecting the 3 key after listening to all new messages
- Messages are never deleted.
Lab

- Work with a buddy
- One of you (the “coder”) codes, the other (the “scribe”) types up the answers.
- One of you submits the code in the
lab2
subdirectory of your personal repo, the other submits a file report.txt
in the lab2
subdirectory of your repo.
- Put the name of the coding buddy into the report
- Push your repo when you are done
- You don't have to complete all parts, but you have to be present and do your best.
The Lab Report File
- Scribe: Make a directory to hold your lab work and put an empty file in it.
cd ~/cs151
mkdir lab2
touch lab2/report.txt
- Now open the file in your favorite text editor.
- If you have no favorite text editor, use Emacs. (“Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.”—Neal Stephenson)
- On Linux, install by typing
sudo apt install emacs
- On Mac OS X, download from here
- Start Emacs. Select Options -> Use CUA keys(Cut/Paste with C-x/C-c/C-v) and Options->Save Options. Then use File -> Open File from the menu.
- Type in today's date and the names of yourself and your lab buddy. Save your file.
- Add your file and push your repo.
git status
git add lab2
git commit -a -m "Started lab 2"
git push
The Book Code
- You need to be familiar with the sample code in the book
- Clone the repo that contains the code
- I fix it when I find typos or update sections
- You pull updates to get those changes
- Open a terminal and type
cd
git clone https://bitbucket.org/cayhorstmann/oodp3code
- Now you have a directory
oodp3code
- Is this directory inside our outside your
cs151
directory? Why?
- Where is the code for the voice mail simulation?
- The scribe puts answers to these questions into
lab2/report.txt
The Lab Code
- Coder: Make a
lab2
directory inside your repo (~/cs151
):
mkdir ~/cs151/lab2
- Coder: Copy the
oopd3code/ch02/mail
directory into your lab2
directory:
cp -R ~/oodp3code/ch02/mail ~/cs151/lab2
- Scribe: What is inside the coder's
~/cs151/lab2/mail
directory now? Have her/him show you. You can just write “... files with extension ...”
- Coder: Type
git status
Then add the lab2
directory to git.
- Scribe: How did the driver do that?
Eclipse
- Coder: Fire up Eclipse and make a new Java project.
- IMPORTANT: When you make a new Java project in Eclipse, its default is to make a brand-new project.
- Huh? That makes no sense. In real life, you never start with nothing.
- Uncheck the “Use default location” checkbox and browse to the
~/cs151/lab2/mail
directory. Finish the wizard.
- NOTE: If you use IntelliJ or NetBeans, you need to put all the source code into a
src
directory. That's fine, but I leave it to you to adjust the steps. If you don't want to deal with that added complexity, use Eclipse.
- Coder: Build and run the program.
- Scribe: What happens when she/he runs it?
- From now on, I'll skip the Coder/Scribe stuff. You know who you are.