CS 151

Cay S. Horstmann
Day 2
- Pre-class reading: Read Section 2.1, 2.6, Section 2.12 intro and subsection 2.12.1 before class. Run the mail system program.
- Clicker questions
- Put your answer into Piazza
- Lab
- Discussion
Day 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
Day 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
Day 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.
- In the hopefully unlikely case that your favorite text editor is Mac TextEdit, be sure to save in plain text, not rich text.
- If you have no favorite text editor, and you want help from me, use Emacs. It is installed in the virtual machine. Start Emacs by typing
emacs &
into a terminal window. The very first time you use Emacs, select Options -> Use CUA keys(Cut/Paste with C-x/C-c/C-v) and Options->Save Options. To open a file, select File -> Open File from the menu and navigate to the file that you want to open (in our case ~/cs151/lab2/report.txt
).
- 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 coder 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, VS Code, NetBeans, or whatever, you follow the same principle. Look for an option to make a project from existing sources. I leave it to you to adjust the steps.
- Coder: Build and run the program. Provide some simple usage example where someone leaves a message and someone else listens to it. Then terminate the program.
- Scribe: What happens when the coder runs it?
- From now on, I'll skip the Coder/Scribe stuff. You know who you are.
Discuss with your buddy and be prepared to report to the class.