Please read this all the way through first, to get an idea of the overall plan of the exercises. Note that there are some general notes at the bottom of this page.
The very first step is get a partner to work with. You can change, and teams often do, but it's much better to work with somebody than to try to learn alone.
These exercises involve some minimal Java, Python and/or C++ programming. We recommend that you arrange yourself in groups so that somebody in each group has at least a little experience with Java, Python and/or C++.
Next sign into the CERN LXPlus cluster:
ssh -X [email protected]
The -X option should forward X11 windows back to your machine. (We use LXPlus because we know that environment would work. In theory, you could also work on your own machine, but you'll probably need to do some configuration and installations)
Then get a copy of the exercise files:
cd ~
git clone --filter=blob:none https://github.com/bobjacobsen/csc-exercises.git
The --filter=blob:none
option improves the speed of the download by bypassing older blobs of data. The history is still there, it'll just be downloaded only if you ask for it later.
Do a bit of setup (this has to be done every time you login or open a new terminal window):
cd csc-exercises/CSC
source setup
Finally, tell us who makes up your team, so we can find you later with updates (only needed once):
./csc_log team "One Student Name" "Other Student Name"
There is no particular time expected for these exercises. You should do them in order, but it's OK to spend more time on the ones that interest you and go quickly through others. It's completely fine to skip any of them, particularly the ones marked "optional".
Nobody does every bit of every exercise, and that's OK.
If you run out of time and want to do more on particular topics, you can come back to these topics later in the week. They can be run anywhere. But please don't feel compelled to work on these after the scheduled sessions; there is a lot more to the School!
If there are any problems or updates to the exercises, we'll post announcements to a Google doc and display them on a screen in the exercise room for your reference.
A short comment on structure: Some of these exercises start by asking you to create a directory by unpacking a .tar file. We do this so that because putting a Git repository inside another Git repository can get complicated.
You can't break anything, so please feel free to experiment!
You should do all three of the these first exercises to work with test frameworks and make sure that your exercise environment is working correctly. Each is a little bit different. Please do
1: TestIntroJava - brief demo of using JUnit for Java code testing. We put this first because JUnit is perhaps the simplest of the unit testing frameworks.
2: TestIntroPy - brief demo of using PyUnit for Python code testing.
3: TestIntroCpp - brief demo of using CppUnit for C++ code testing. Will benefit from a bit of C++ experience with header files, etc, but can be done without it.
We then move forward to a more significant example, the SumPrimes code from lecture. Do one or more of the following. (If your team speaks all three languages, you could do all three, but that's definitely optional)
4: TestSumPrimesJava - SumPrimes in Java
5: TestSumPrimesPy - SumPrimes in Python
6: TestSumPrimesCpp - SumPrimes in C++
People with experience programming C and C++ close to the hardware might find this a little basic (though the valgrind tool can be useful even for experts). Everybody else should definitely do this one to learn more about how memory really works.
9: MemIntroCpp - Testing for C++ memory faults
Depending on your level of experience, these are all optional. People who just use git
by recipe or want a better understanding of the basics, including how to use it locally for your own individual work, would probably benefit most from the first two. People with more experience might find the more advanced topics in the last three interesting. Doing the GitBisect exercise is recommended for everyone.
10: GitBasics1 - Simple use of git - basic introduction, so if you have git experience you might want to quickly scan through this for things you haven't seen (do you know what git add --patch
does?)
11: GitBasics2 - Demonstration of Git branching - also basic. Good introduction for people who haven't done much branching and merging on their own, but optional for people who have.
12: GitBisect - Introduction to the use of git bisect
to track down where an error was introduced, and your options for handling the error.
13: GitRecovery - Managing the head of your branches. For example, you've committed something that maybe you shouldn't have. What are your options now, beyond the XKCD "delete and download a new one"?
14: GitHistory - Covers the tools for creating a linear history in Git: squashing and rebasing.
If there are any last-minute corrections to the instructions, we will post them in the exercise room and on this Google Doc. To update your local copy of these exercises, do
cd ~/csc-exercises
git pull
cd
and then refresh your web browser windows to pick up the new instructions.
Updated PDF files are available for lecture 1 and lecture 2 in Indico.
We continually update the exercises in GitHub. After the School is complete, you can get the specific version we used by looking for the CSC-2024 release tag.
Note that the instructions for these exercises are written for a Bash-type shell. If you use a C-type shell:
- Replace "export SOMETHING=..." with "setenv SOMETHING ..."
- Replace "source setup.sh" with "source setup.csh"
Style convention: Indented commands in code font
are meant to
be cut and pasted into a command line:
cd
echo "Done!"
When we want to show the output from a command, we'll include the command prompt:
$date
Thu June 15 10:37:13 PDT 2018
That's not meant to be cut-and-pasted in its entirety, just the parts after the $ or % command prompt.
The bibliography is kept in a Google Doc. It is periodically updated as cool new things are found.
For more information on Java math routines like floor(...), sqrt(...), etc please see the Math class doc page.For more information on the JUnit unit test classes for Java, see their class documentation.
For more information on the CppUnit unit test classes for C++, see their web page.
For more information on valgrind, see their documentation page.
Information on Git:
- The detailed Git documentation.
- Lots of questions and answers on Git usage.
The web has lots of talks and tutorials on more advanced Git topics.