A. Introduction
In light of Wednesday's midterm, this week's lab is meant to be a low-impact introduction to project 1. Attendance is not required for this lab and there is nothing to turn in. However, TAs will still hold labs which will effectively be highly staffed office hours of which you should take advantage!
You may find that the information is opaque the first time you walk through this lab. That is okay. Our goal is for you to understand the specifications and have some sense of how you may want to implement parts of the project. As you continue to work on this project for the next two weeks, definitely revisit this lab as you see fit to organize your thoughts.
B. Understanding Project 1
If you haven't already, head into your class repo and git fetch and merge the skeleton for project 1.
git fetch shared
git merge shared/proj1 -m "Get proj1 skeleton"
git push
The project will be due in about 2 weeks (10/13), so it's a good idea to try to make progress as soon as you can. Here are some quick tips to getting started on the project.
- Start by reading the specs here.
Take notes as you're reading the specifications.
- What is the overall goal for this project?
- What is Backus-Naur Form and how does it work?
- What functions are to be supported by this project. What is the syntax for the functions.
How do the functions work? For example...
- How does a
select
statement work and how it can be used bycreate
. - What is a natural inner join?
- How does a
- Open up the code and read through what's given to you.
Try drawing the hierarchy of the classes and their subclasses in the skeleton. For each class in this hierarchy, it may help to think about and write out answers to the following questions:
- What features do I need to define in this class?
- For each of these features, should it be written by overriding a superclass method, should it be written as a new method, or would it already have been inherited?
- How would one test the correctness of the finished version of this class?
Understanding the spec
Here is a mix of questions to help you gauge your understanding of the spec. Try discussing them with a partner such as the person sitting next to you.
You're a catering company and CS61B has requested that you cater their grading party! Your database holds a table below named orders
which contains rows representing orders made by TAs.
Food | Count | Orderer |
---|---|---|
Boba | 3 | Christine |
Boba | 2 | Andy |
Chicken Fried Steak | 107 | Antares |
Gumbo | 1 | JC |
Gumbo | 5 | Alex |
Steak | 4 | Eli |
Steak | 1 | Kevin |
Udon | 2 | Steven |
- What does a
.db
file containing the contents of the table look like? - You want to create a table named
hungry
which contains only orders withCOUNT > 3
. Write acreate
statement to do this. Prof Hilfinger
is also hungry. He has ordered20
servings ofBoba
. Insert this row into both theorders
andhungry
tables.- Your catering company does not actually cook the food. Instead you've delegated the task to a few different restaurants. This information is held in the table named
providers
.
Food | Restaurant |
---|---|
Boba | Tea One |
Boba | I-Tea |
Chicken Fried Steak | Angelines |
Gumbo | Antaress Apartment |
Gumbo | Angelines |
Steak | Tasty Pot |
Udon | Tea One |
- What is the output for the command:
select Orderer, Restaurant from orders, providers where Orderer <= 'B';
. Make sure to watch out for the ordering. - Finally, suppose that the
Food
column in providers was actually namedDish
. What would be the result of:select Food, Dish from orders, providers where Food > 'A' and Food < 'D';
Understanding the code
This section is mainly for if you plan to use the skeleton we have provided. Be sure to also read the last section titled "Advice" in the spec. You'll note that there are quite a few "suggested skeleton" files. You're allowed to throw these files away but try to understand why we might suggest this first before doing so!
- What class do you compile and execute to run the command line?
- What is the pipeline of classes called to execute a command such as
create
? - What is a database? What are the components of a database and how are the different components represented in the skeleton files provided?
- How do you notify the user that an error has occurred? Hint: take a look at
Utils.java
. - How do you define unit and integration tests for this project? Hint: take a look in the
\testing
directory.