ICS 21 / CSE 21 Summer 2012
Lab Manual


The assignments


About the lab assignments

The best strategy to do well on the lab exams by far is for your pair to complete the corresponding assignments; they are specifically designed to prepare you for the lab exams. Lab exams are taken individually, so it is a good idea for both members of the pair to participate fully in completion of the assignment; that way, each member is prepared for the exam.

Each lab assignment asks you and your partner to design and implement a Java program, putting into practice the concepts discussed in lecture and the readings. It will be very close to the program used in the corresponding lab exam; once you complete the exam, its program should look a lot like the one you wrote for the assignment. Each assignment not only gives you the specifications for the program (and its various components) but also spells out the portions of the program that are candidates for you to implement in the lab exam you take.

We will have several versions of the lab exam. You will not know which version of the test you will be taking until the start of the exam; this is also true for retakes. So, again, it's a really good idea to complete the entire assignment, and understand it thoroughly before the lab exam. Most importantly, you should focus on being at the point where you could reimplement any part of the assignment, not by simply regurgitating code you've memorized, but by understanding what the code you're writing means. (Few students pass ICS 21 / CSE 21 by memorizing code for their lab exams, and almost none of those few succeed in subsequent courses.)

You are free — and encouraged — to get as much help as you need to complete the assignments from any source you like. But beware: some students get so much help that they end up doing little of the work themselves, and that usually results in a lack of knowledge and not passing the lab exam. And remember that simply copying someone else's work into your lab exam is considered an infringement of academic honesty rules.

If you and your partner prepare to work on your lab assignments before you come to lab, and work diligently once there, you should have no difficulty finishing an assignment before the day of its lab exam.

It typically takes several hours in addition to your scheduled lab time to complete a lab assignment (though times vary significantly from one pair to another). If you need additional lab time, there is an open lab in ICS 364, which you may use any time it is open; you may also use any other ICS lab when no class is in session. Seating is on a first-come, first-served basis. The lab attendants on duty at those times are there to watch over the equipment and the room; they cannot help you with your assignments.


Pair programming

What is pair programming?

For all of the assignments in the course, you will be required to employ an approach called pair programming. Pair programming is not just two programmers working separately on a task, with the work divvied up between them. In pair programming, two programmers share one computer. One is the driver, who controls the keyboard and mouse. The other is the navigator, who observes, asks questions, suggests solutions, and thinks about slightly longer-term strategies. The two programmers switch roles about every 15-20 minutes, the goal being that both members of the pair have complete mental ownership of all the work that's done, even though only one person at a time is typing. This obligates both partners to communicate with one another about what they do and do not understand, with each partner bringing the other one up to speed when necessary. In so doing, both partners have a firmer grasp on what they're doing and, at least as importantly, why they're doing it that way.

A pair of programmers (as described here) nearly always beats the stereotypical solitary loner of similar ability. The pair produces more high-quality code in less time, by far more than a two-to-one margin. We'll be requiring you to follow this model, and will be keeping track of students who aren't; we reserve the right to penalize students who routinely refuse to work as good pair programmers.

While some industry software development environments use pair programming to (documented) good effect, the reality is that individual programming is still a widely-used strategy in the real world. Many future courses that you'll take here will require individual work, as well. Study after study shows that working in pairs at this stage of your development as computer scientists will strengthen your abilities to work individually, as well as in pairs.

Pairing rules

For each lab assignment, you will be required to select a lab partner. It is not necessary that your partner is enrolled in the same lab section as you are, but be aware that this will make scheduling a bit more difficult for you, since being in the same lab section provides obvious overlap in your and your partner's schedules.

For each paired assignment, you will be required to partner with someone who you have not partnered with previously in this course. (There are all kinds of reasons why it's great to get to know at least a few people in the course; this is one way to ensure that you'll have that opportunity.)

After deciding to pair up on an assignment, notify your TA of the pairing. Your TA may prefer this notification to be done in person or via email; if you're not sure, ask your TA for his or her preference.

Pairing advice

The best time to find a partner is during your scheduled lab section. Don't be shy! Talk to people! (Part of the benefit of a university education is the social network that you'll have when you're finished. True story: Every job I've had since I enrolled as a student at UCI, including this one, was a direct result of getting to know someone while I was a student at UCI.) If you're having trouble finding a partner, talk to your TA; he or she will be happy to help you find one.

It's not a bad idea to find a partner whose skill level is similar to yours, or one who is more skilled in areas where you are less skilled. This won't always be possible, and it's sometimes hard to compare skill levels at all, but students tell us (and other data support) that pairs are most productive when the partners are at about the same level.

Still, people often pair up with another whose skills and abilities are different. The differences may be great or small; one member may have more strengths than the other. But this is exactly like most real-world working situations. Part of accomplishing a task is to get the most out of each member and make each member stronger and more productive on subsequent tasks.

A clearly stronger partner may feel frustrated or slowed down by the other partner, but the stronger partner benefits from the teamwork in many ways: The other partner's requests for clarification often point out flaws in the approach or solution, the teamwork skills gained have great value in the job market, and the exercise of providing a clear explanation solidifies and deepen's the explainer's own understanding.

The less strong partner may feel that questions hold the other partner back or that there is no benefit to participating actively, but pair programming studies show that paired work is consistently better than work the stronger partner does individually. It is part of each partner's job to understand the whole task; that means asking questions when necessary and answering them when possible.

Am I expected to work with my partner outside of the scheduled lab sections?

Generally, yes. You'll likely need to spend some time working outside of the scheduled lab sections. It's not my assumption that you'll always be able to get the assignments done by working strictly within the lab sections; it's quite possible that all of them will take more time than that.

Understand, though, that you're not doing pair programming if you're in separate locations talking via instant messages, sending code back and forth via email, or even talking on the phone. Pair programming requires both partners to be in the same room, sitting behind the same computer, with one acting as the driver and the other acting as the navigator. I'm not unsympathetic to the fact that scheduling time to work together is difficult, but it's a requirement of the course, and you should be aware of it up front.

How does pair programming affect my grade?

All graded items in the course — the lab exams, the Midterm, and the Final Exam — are done individually, so how your partner scores on these items will not affect your scores.

Since pair programming is a requirement of this course, you are expected to work collaboratively with a partner. Failure to participate fully and cooperatively will count against you; you could receive a deduction of up to ten percentage points in your total percentage, depending on how severely and how often you failed to participate in pair programming.

After each assignment is complete, you'll be asked to individually submit a brief partner evaluation. It is required and due when indicated on the Schedule. As discussed in the Course Reference, you will earn points toward your total percentage for filling them out — more if you've answered the questions thoroughly or insightfully.


A lab survival guide

To make your and your partner's time in the lab as productive and pleasant as possible, we strongly recommend that you do each of the following things.

Prepare before coming to lab by reading the assignment beforehand, thinking about how to do it, talking it over with your partner and asking questions about it. Then, when you get to the lab, you'll be your most productive.

Start early on each assignment. Lab assignments in computer science, more than in most disciplines, are time-consuming; working on a computer until a program works typically takes much more time than work-the-problems assignments. Your team should start a lab as soon as you complete the lab exam associated with the previous assignment; you can't do a week-long lab in just a couple of days. Do not wait until your lab section meets to begin a lab assignment: all the necessary information for each lab is in this manual. Starting promptly reduces your frustration, since you'll have time to ask questions when difficulties arise, and will have sufficient time to finish the lab before the lab exam date.

Pay close attention to detail. Computing, more than many other disciplines, requires precise, literal attention to detail. Take things slowly and deliberately. Wring every bit of information you can out of the assignment description; read the lab exams carefully to know what they require of you.

Remember that you're not alone. As you work on your assignments, we encourage you to seek assistance from your partner (obviously!) and from the TAs and your colleagues. TAs will help you with the mechanical details of using the hardware and the software, and they will give you help and hints towards solving the assignments. Be careful, though: if you receive so much help that, in effect, others did the assignment for you, it's very likely that you will not have learned enough to pass the lab exam.

Come to lab regularly, even if you or your partner have access to a computer elsewhere. In past offerings of this class, there has been a strong correlation between attendance at labs and passing lab exams without several retakings of it; your interaction with your partner, other students and course staff helps you learn the material more completely and quickly. And it's obviously hard to do pair programming in lab if only half the pair comes to lab.

Feel free to experiment. Much of computing is learned by trial and error, trying things out to see what works. (That's why little kids are so good at it; they learn everything that way.) But adults are often uncomfortable with the "error" part; they hate to "waste time" and are embarrassed when they make mistakes. But to learn the practical details, you'll have to put that discomfort aside and be willing to experiment. If you are concerned an experiment might foul up your assignment, make a copy of that work before doing the experiment. If the experiment goes awry, you can use your copy to "back up" to where you were. Be prepared to tell TAs what you've already tried when you ask for their help. Experiment while working on the assignments — but not on the lab exam: you should have things figured out by then!

Don't lose it. Computers can be frustrating; it's challenging to communicate with a dumb machine. If you feel like losing your temper (and nearly everyone who works with computers occasionally does), take a deep breath and remember: It's only a machine. It's only an assignment. It's only a class. Someone is available who can help you find a way out of your difficulty (especially if you've started early and left adequate time).


How do I set up Java and Eclipse on my computer?

If you choose to do any of your coursework on your own computer — which is fine, though you'll want to be sure to include your partner in the work you're doing — you'll need to download and install two pieces of software:

If you do choose to use Eclipse on your computer, be sure that you use the ICS 21 / CSE 21 Eclipse Workspace instead of the workspace that Eclipse sets up by default. Many settings have been changed from their defaults to appropriately support your work in this course, and you should be sure that you're working in an environment that matches as closely as possible the environment that you'll be using during lab exams.