W12:Labs:lab05
From 56wiki
CS56—Advanced Applications Programming—W12
W12:Exams | W12:Homework | W12:Labs | W12:Calendar and Lecture Notes | W12:Syllabus | W12:Choice |
---|
lab00 | lab01 | lab02 | lab03 | lab04 | lab05 | lab06 | lab07 | lab08 |
lab05: Preparing for Code Reviews, Starting Choice Points
Tip
If you find typos, note them on the discussion page. This lab is "locked down" for edits only by the instructor and the TA until after the due date has passed.
assigned | part 1 (lab05a) due | part 2 (lab05b) due | part 3 (First Choice Points Assignment) due |
---|---|---|---|
Thu 02/16 | 5pm Monday 02/20 or 48 hours before your code review whichever is later. | 5pm Friday 02/24 | 5pm Friday 03/02 |
Overview
This lab is in THREE PARTS with three separate due dates.
Part 1 (lab05a)
This is just an overview---detailed instruction follow below. Please read this over though so that you KNOW what you are doing today.
Step 1 is done INDIVIDUALLY (even if you normally work in a pair.) And how you complete the first step depends on whether the code for lab04 appears under YOUR name on the web, or under a pair partner's name.
Part 1, Step 0: Meet your PCR Code Review Team
Because you are meeting your PCR Code Review Team, you MUST attend lab this week in person.
At this step, you need to introduce yourselves to one another, share your CSIL email accounts with each other, and be sure that you are able to keep your appointment with each other. You will learn who is on your team, make sure you are clear on when and where to show up, and learn whose code you'll be reviewing, and who is reviewing your code.
Details below!
Part 1, Step 1: If the code appears on the web under YOUR name
You will make a few minimal changes in your lab04 build.xml file to make it easier for folks to review your code—mainly, adding line numbers to your source files. You then just have to do an "ant publish" so that this new version of your code is available online. Detailed instructions appear later in this lab.
Part 1, Step 1: If the code appears on the web under your PAIR PARTNERS name
You put a file on the web at http://www.cs.ucsb.edu/~yourusernamehere/cs56/lab04/index.html with a link to the page on your pair partner's account where your joint work appears. (Detailed instructions later in this lab.)
You should also make sure that your pair partner completed his/her responsibilities under Part 1, Step 1. If he/she is missing in lab, then you'll need to track him/her down so that YOU don't lose points.
Part 1, Step 2 (for everyone)
Next, you'll need to look at your Peer Code Review Team Assignment to figure out whose code you are reviewing.
You will be the "code inspector" for exactly one other person on your team, and you need to familiarize yourself with that person's code. You should select a section of that code for review, and try to find at least a few "issues" to note. (We'll discuss that in more detail below.)
Three important notes on this step:
- Note that in order for you to complete this step, the person whose code you are assigned to review has to be finished. So, you might not be able to start on this part until after 5pm on Friday.
- Note also that this means that YOU MUST SUBMIT SOMETHING by Friday 5pm so that the other person has something to review. Even if everything is not perfect, SUBMIT WHAT YOU HAVE by 5pm Friday.
- If the person's whose code you are assigned to review does NOT have their code up by 5pm Friday, then please simply note this, and you will be excused from doing that part of the assignment. In that case, the moderator of your Peer Code Review will do this step on your behalf as needed.
Part 2 (lab05b): Setting up a Mantis Ticket for your First Choice Points Assignment
Part 2, consists of setting up your first Mantis Ticket for a Choice Points programming assignment. Setting this up is 100 points towards your lab grade.
We will discuss how to do this in Lecture.
Part 3 (lab05c): Working on your choice points assignment
The choice points assignment you set up for lab05b needs to be completed by 5pm the FOLLOWING Friday 03/02—i.e. two weeks from now).
Because this will be the basis of the second round of code reviews, the deadline is STRICT.
The number of points it is worth is determined by the size and scope of the project you take on, but you should aim to earn at least 300 choice points. (You may earn more if you take on a larger project.) The deadline for earning at least 300 choice points is 03/02.
Step-by-Step
Part 1, Step 0: Meet your PCR Code Review Team
(a) First, find out who is on your team. It is helpful if you do this BEFORE lab, but if you didn't, do it now.
Log on to Gauchospace, and find the the day and time of your code review in Gauchospace in the comments under the grade item PCRTeam.
(b) The number of your team is a two digit number, e.g. 34. The first digit is your lab section (2, 3 or 9), and the second digit is your team number within that section.
- If your second digit is 9, it means you have NOT been assigned to a team... in that case see your PCR Moderator, who will be in lab today (Aaron, Geoff, or Allison.)
(c) To find out the names of the other people on your team, consult this Google Calendar. Find your team's meeting time (during the period from 02/21 to 02/27), click on the meeting time, and find out the names of the other people on your team. Also find out the name of the person immediately above your name—you will be reviewing that person's code. If your name is first on the list, then you will be reviewing the code of the person whose name is last on the list.
http://bit.ly/cs56w12pcrcal
For example, in the following list, Bob reviews Alice, Chip reviews Bob, Danielle reviews Chip, and Alice reviews Danielle.
- Alice
- Bob
- Chip
- Danielle
(d) Find out the CSIL USERNAME of the person whose code you are reviewing. You will need this in a later step.
Now you are ready for Step 1, which has two different versions depending on whether you, or a pair partner, was the one that submitted lab04.
Part 1, Step 1: If the code appears on the web under YOUR name
You will make a few minimal changes in your lab04 build.xml file to make it easier for folks to review your code—mainly, adding line numbers to your source files. You then just have to do an "ant publish" so that this new version of your code is available online.
(1) Add this target:
<target name="linenumbers" description="Creates a file containing all source files with line numbers"> <exec executable="bash"> <arg value="-c"/> <arg value='tree -ifQ src | grep \.java\"$ | xargs pr -n > numberedsource.txt'/> </exec> </target>
(2) Add linenumbers as a dependency of the publish target.
(3) Add this line into your publish target, so that the numberedsource.txt files gets copied to the web:
<copy file="numberedsource.txt" todir="${webRoot}/${projectName}/browse"/>
(4) Test it: If you do ant publish, it should invoke the linenumbers target, and then copy numberedsource.txt to the web, under the source link.
That is, if you click your web page, and then click on source, you should see the file numberedsource.txt, and it should contain the source with linenumbers.
If it does, you can move on to the next step!
Part 1, Step 1: If the code appears on the web under your PAIR PARTNERS name
You put a file on the web at http://www.cs.ucsb.edu/~yourusernamehere/cs56/lab04 with a link to the page on your pair partner's account where your joint work appears.
To do this, open a terminal window, and do this command to create the proper directory:
mkdir -p ~/public_html/cs56/lab04
Then cd into that directory, and edit the file index.html. In it, put this, except SUBSTITUTE in values for all the stuff in all caps (except the word DOCTYPE—leave that exactly as it is.)
<!DOCTYPE html> <html> <head> <title>cs56, w12, lab04, YOUR NAME HERE</title> </head> <body> <h1>cs56, w12, lab04, YOUR NAME HERE</h1> <p>I worked with PAIR PARTNER'S NAME HERE as my pair partner.</p> <p>Here is our <a href="http://www.cs.ucsb.edu/~YOUR_PAIR_PARTNERS_CSIL_ACCOUNT/cs56/lab04">lab04 page</a></p> </body> </html>
After putting this file in place, to ensure the directory is readable on the web, do this:
chmod a+x ~ chmod -R a+r ~/public_html
Then, check the link by going to http://www.cs.ucsb.edu/~yourusernamehere/cs56/lab04/index.html
You should get a web page with a link to your pair partner's lab04 web page.
You should also make sure that your pair partner completed his/her responsibilities under Part 1, Step 1. If he/she is missing in lab, then you'll need to track him/her down so that YOU don't lose points.
Part 1, Step 2 (for everyone)
Next, you'll need the CSIL Account of the person whose code you are reviewing (see Part 1, Step 0).
You will be the "code inspector" for exactly one other person on your team, and you need to familiarize yourself with that person's code. You should select a section of that code for review, and try to find at least a few "issues" to note. (We'll discuss that in more detail below.)
Go to that person's lab04 web page:
http://www.cs.ucsb.edu/~THAT_PERSONS_CSIL_ACCOUNT/cs56/lab04
Check in with him/her. If he/she is done with lab04, then awesome! If not, then find out whether they expect to be done by 5pm Friday. Encourage him or her to get done by 5pm
Friday, so that you can complete the rest of this step. If you can't do it now, come back to it later... after 5pm Friday, but before 5pm Monday or 48 hours before your
code review
whichever is later.
Three important notes on this step:
- Note that in order for you to complete this step, the person whose code you are assigned to review has to be finished. So, you might not be able to start on this part until after 5pm on Friday.
- Note also that this means that YOU MUST SUBMIT SOMETHING for your OWN lab04 by Friday 5pm, so the other person has something to review. Even if everything is not perfect, SUBMIT WHAT YOU HAVE by 5pm Friday.
- If the person's whose code you are assigned to review does NOT have their code up by 5pm Friday, then please simply note this, and you will be excused from doing that part of the assignment. In that case, the moderator of your Peer Code Review will do this step on your behalf as needed.
Here's what you need to do.
(0) Use your editor to open PLAIN TEXT FILE (not word document, not pdf, just plain text.. i.e like you edit with emacs, vim, etc.) called ~/cs56/lab05a.txt.
In that file, at the top, write a line like this, substituting in values as needed (USERNAME might be his/her own, or the one from his/her pair partner.)
cs56, w12, lab05a, MY NAME HERE Reviewing code from OTHER PERSONS NAME HERE. His/her CSIL account is CSILACCOUNTHERE Her/his code is at the website: http://www.cs.ucsb.edu/~USERNAME/cs56/lab04 ----
(1) Look at the person's code on the web (use the "browse" link, or the "browse with line numbers" link on their web page.)
(2) Look over the handout from class titled "Coding Guidelines: Finding the Art in the Science".
(3) Use that as a checklist to check over the lines of code, and see if you can find any issues with the code. We are looking for two types of issues:
- Examples of good practice—places where the author of the code did well
- Examples of things that can be improved—places where the guidelines suggest a different option that would make the code better.
(4) Identify a particular part of the code to focus on. It should be at least one method, and no larger than a full class. For this part of the code, write down as many issues as you can. Find at least two examples of good practice, and two examples of things that can be improved.
These should be four DIFFERENT ISSUES (i.e. not just four instances of the same basic issue.) (What I mean by that is: don't just find two "well named variables" and two "poorly named variables" and call it a day. That's really four instances of the "same" basic issue.
You may wonder what you should do if you cannot find four issues. My advice is: Look Harder. There is so much code there, and so many things to consider. It would be astonishing if you really could not find four things. If you are really stuck, then just write that you are stuck---but if the TA, Instructor or Moderator can find four issues where you said there were none, you might lose some points.
Only four issues are needed to do the "minimum" and earn full credit, but for folks who do a particularly good job, Moderators have the discretion to award up to 50 Choice Points as a kind of "extra credit bonus" (an as an incentive for doing more than the minimum.)
(5) Once you've identified the portion of code to focus on, add this in your ~/cs56/lab05a.txt file, substituting in values as needed.
Focus of Code Review: NAME OF FILE HERE, NAME OF CLASS OR METHOD, LINE NUMBERS
Examples:
Focus of Code Review: Skateboard.java, class Skateboard, entire file
OR
Focus of Code Review: AllMyOwnDrawings.java, method: drawPicture1, lines 15-75
(6) Then, write your issues, separating each one by a blank line.
To start each issue, use a ! for positive comments, a ? for suggestions for improvement (or in cases where something is not clear).
Then write the line number(s), and then your comment.
Example:
! lines 5-6: the @param tag text is very nice---very helpful description. ? line 10: choice of parameter names: consider xll and yll (for x lower left and y lower left), which are a bit more descriptive. ? lines 14-17: The multiplication by the integer 1 is suspicious---what is this really doing? Perhaps it is unnecessary? Also it is not clear whether integer division is the right choice. Consider both rewriting the code to be more clear, and adding a comment above to explain the math. ! lines 19-20: These lines are nicely commented--it is clear what is going on here.
(7) When you've completed this, please submit it via the turnin program as follows:
cd ~/cs56 turnin lab05a@cs56 lab05a.txt
And you are then done with Part 1
Part 2 (lab05b): Setting up a Mantis Ticket for your First Choice Points Assignment
Part 2, consists of setting up your first Mantis Ticket for a Choice Points programming assignment. Setting this up is 100 points towards your lab grade.
We will discuss how to do this in Lecture.
For this step, what you will turnin is a text file called ~/cs56/lab05b.txt that simply contains your userid, name, the ticket number, and a one line description, e.g.
jsmith,Joe Smith,0000457,GUI for a schedule planner
dchen,Danni Chen,0000458,Improvements to UCSB Course Scraper from ticket 342
Use turnin lab05b@cs56 lab05b.txt to submit this via the turnin program.
Your grade will be determined by whether you submit this via turnin, as well as the contents of the ticket itself.
Part 3 (lab05c): Working on your choice points assignment
The choice points assignment you set up for lab05b needs to be completed by 5pm the FOLLOWING Friday 03/02—i.e. two weeks from now).
Because this will be the basis of the second round of code reviews, the deadline is STRICT.
The number of points it is worth is determined by the size and scope of the project you take on, but you should aim to earn at least 300 choice points. (You may earn more if you take on a larger project.) The deadline for earning at least 300 choice points is 03/02.
We will discuss more about the form of your submission for your choice points code in Lecture next week (and this page will be updated). For now, know that you need the following:
- Set up your code in the package edu.ucsb.cs56.w12.choice.ISSUENUMBER
- Use the structure we've been using in labs (separate build and src directories, ant build.xml file as for lab04, javadoc published to the web, etc.)
In the end, you'll submit your code to turnin using:
turnin lab05c@cs56 directory