Operator precedence in the Java language

February 6th, 2008  |  Published in Programming, Teaching

This handout presents Java’s operator precedence rules: in general terms (for CS1 students and most everyone else) on the front, and in excruciating detail (for language lawyers and compiler frontend implementors) on the back.

Why integer overflow wraps around

February 6th, 2008  |  Published in Teaching

Here’s a fun handout that I made for my CS1 students. Click the image to download a PDF.

Why integer overflow wraps around

Ideas and resources for course materials

February 5th, 2008  |  Published in Teaching

In August 2007, I led a workshop at Wisconsin for other graduate student instructors on making better course materials. I discussed how to use slides, handouts, and dynamic internet resources effectively to serve lectures and learning. I have reproduced here the text of one of my handouts from that talk; I have added hyperlinks and removed some Wisconsin-specific terminology. If you’d like a printable PDF, you can download the version I gave out at the workshop.


Suggestions on how to use slides

Students often expect a downloadable set of slides to be a standalone artifact that can serve as a substitute for engaging the material in lecture. Making this assumption is bad for them, but molding your slides to meet this assumption is bad for everyone. You can discourage this behavior by making slides that serve your presentation.

Most of the bad slides you’ve seen contain a laughably small amount of content. This is primarily due to two factors. The main factor is that the medium limits the amount of information you can fit on a slide (consider 36 point type on a low-resolution screen). An important auxiliary factor is that lazy speakers will use slides merely to present their own talking points or an outline of their talk. This doesn’t benefit the audience, who can read as well as the speaker can, and it is of dubious benefit to the speaker, who should have practiced before presenting.

You’ll probably want to provide your students with some lasting artifact of your lectures or course presentations, but you shouldn’t do so by making your slides worse. Instead of putting enough “stuff” on your slides so that students don’t need to listen to you teach, start by developing a handout that covers the most important parts of a topic in detail. Then, develop a lecture in conversation with your handout, using the slides to present detailed examples and to reinforce the key points of your lecture.

A good rule of thumb for slides is to use them as much as possible for things you can’t do any other way: to illustrate things that you couldn’t easily draw on the blackboard; to present larger examples; and to present examples with animations or other multimedia content. You can also use slides to underline particular points (e.g. important definitions, which students can benefit from seeing as well as hearing), to give students an idea of what to expect in the rest of the lecture, and to make them laugh. (Don’t underestimate how easy or effective it can be to use humor in class. After twenty minutes of a late-semester lecture, your students will be inclined to laugh at almost anything.)

Technology-specific tips for slides

There are three major options for slide software: you can use Microsoft PowerPoint, you can use Apple Keynote, or you can use a dedicated drawing program like Adobe Illustrator and then present your slides in a PDF viewer. (For the record, I recommend Keynote to Mac users and Illustrator to Windows users.) These tips should apply to all of these options.

First, learn your software. This may seem like an obvious suggestion, but people often don’t do it. Putting in a couple of hours to skim the manual or work through tutorials can dramatically increase your productivity.

Another potential time-saver is putting in the effort to make your own custom templates or themes for slides. This will save you the tedious work of modifying defaults every time you make a slide presentation, and can help you enforce a consistent personal style.

I’ve had the best luck making figures and diagrams in a dedicated drawing program and pasting them in to my slides. (Typically, the drawing support in slideware is rudimentary at best.) If you do this, though, you may not be able to manipulate individual parts of the diagram independently (e.g. for animating appearances) from within the presentation software. In this case, you’ll need to paste several times, copying each independent part of a diagram in turn.


Software suggestions

I find myself making two kinds of handouts: those that are primarily diagrams or pictures, and those that are primarily text. Of course, almost any good handout will combine graphics and prose, but it seems that any particular handout will either demand a large drawing effort or a large writing effort. I use different programs for each kind of handout.

For handouts that involve mostly drawing, I use OmniGraffle, which is published by The Omni Group, and Adobe Illustrator. OmniGraffle is Mac-only; comparable packages are available on Linux (e.g. dia, the free diagram editor), and on Windows (e.g. Microsoft Visio).

For handouts that involve mostly writing, I use Adobe InDesign. (Apple’s Pages is also a good choice.) InDesign and other page layout programs are great because of the degree of control they allow you. On many handouts, controlling the finer points of design and layout is essential: you’ll need to be sure that the text is readable and that it fits well on the page. (For simpler handouts, of course, your favorite word processor is certainly fine.)

Technology-specific tips for handouts

Making templates for handouts can be a great time-saver, just as it is for slides. My Anatomy of a simple handout provides an annotated version of one of my handout templates, explaining the whys and hows of each part.

You can apply the template idea on a finer granularity as well. If you make a lot of similar figures in your handouts, consider saving template graphics to a file so that you can reuse them (some software also supports creating graphics libraries or stencils). This is a very small time investment that you will greatly appreciate when you’re making the thirtieth Hasse diagram, molecule, historical map, or whatever in a given semester. Remember that you can reuse most of the graphics you make in handouts for your slides with only minor effort to remove details that wouldn’t reproduce well in the slide medium.

Many programs let you place a text area containing variables. Variables are dynamically updated to contain the text of some useful value, for example the current document’s file name or the time that a document was printed. I use variables in my handout templates so I can be sure that a hardcopy handout corresponds to the most recent version and (more importantly) so I can find the right file to edit or print when I need a handout in the future!

Dynamic resources

Some of the best course materials you can provide won’t be “materials” in the conventional sense at all: they will be experiences that your students have interacting with dynamic internet and multimedia resources. In this section, we’ll briefly discuss a few possibilities for using technology to teach.


There are a few ways to keep your students up-to-date with announcements and assignments: verbal mentions in class, notices on a syllabus, and mass emails to the course list. However, there are a couple of higher-tech ways to help your students stay informed.

Consider keeping a course weblog: it is easier to post announcements than it is to modify a web page, there is a permanent record of announcements (unlike with email or verbal notices), and tech-savvy students may subscribe to your announcements with a feed reader program, receiving updates automatically. (You can also use this technology to automatically update a course web page.) Some weblog systems also allow students to post comments, which allows them to discuss or ask for clarifications. (You can host a weblog for free at blogspot.com or wordpress.com.)

Also consider publishing your course syllabus as an iCalendar, which is a machine-readable calendar format. This will enable students to subscribe to your calendar and download your syllabus into their desktop calendar, mobile phone, or PDA. (Google Calendar and most desktop clients feature this capability.)


There are several dynamic resources you can use to encourage students to collaborate, to learn from and teach one another, and to grow together as a learning community. The simplest is the course email list, which can be a forum for continuing class discussions online. One successful assignment that I’ve given several times has asked students to critique the design of some real-world thing by using principles they’ve learned about the design of programs. The catch is that I encourage them to find funny examples of bad design, and to send their answers to the class list. Students seem to enjoy the opportunity to discuss and entertain one another, and the assignment reinforces and makes concrete the rather abstract material from class. Furthermore, having responses appear in “public” provides an incentive to do the assignment and to take it seriously.

The computer center typically sets up email lists for each course, which your students will be able to post to. If you’d rather use your course email list strictly for course-related announcements, you can create a dedicated mailing list for class discussions using a free service like Google Groups.

If you’re teaching a class with substantial lab or project components, you may find it useful to create a wiki, which is a dynamic web site that your students can read and (easily) update. This doesn’t lead to total anarchy (as you might assume), since there are ways to protect individual pages from malicious changes. Most students are familiar with wiki software because of the popularity of the Wikipedia project. There are several web sites that will host a wiki for you for free; wikihost.org and wikia.org seem popular, although I have not personally used either.


The best course materials combine graphics and prose (spoken or written) to elucidate concepts and processes. Sometimes, though, static pictures aren’t as helpful as they could be. Screencasts are short narrated movies of what’s happening on your computer screen, and they can be useful for demonstrating almost anything you can do with a computer: analyzing statistical data in a spreadsheet, maintining an online bibliography, or searching the library catalog, to give just a few examples. Numerous free and commercial screencast software packages are available for the Mac, Linux, and Windows. (I use iShowU on the Mac; Snapz Pro X is also well-regarded.)

For further reading

I can’t recommend Edward Tufte’s The Cognitive Style of PowerPoint (Graphics Press) highly enough. This essay, Tufte’s other books, and his writings at edwardtufte.com have been quite influential to my own presentation style. Tufte expertly diagnoses the problems with typical slide presentations and points to some potential solutions.

While Tufte’s essay focuses on typical slide shortcomings, Cliff Atkinson has written a different kind of book about slides and presentations. His Beyond Bullet Points (Microsoft Press) doesn’t focus on the limitations of the slide medium or typical slide pitfalls; rather, it tells you how to make better presentations by structuring your talks as stories in multiple acts. In my experience, using this approach has really helped me to explain complex technical topics.

There are many web pages and weblogs devoted to developing better presentations; two well-known sites are presentationzen.com and beyondbullets.com. (The latter is written by Cliff Atkinson, and features resources for readers of his book.)

A good general reference on typography (useful for slides and handouts) is Robert Bringhurst’s The Elements of Typographic Style (Hartley & Marks). (The web site
webtypography.net shows how to apply Bringhurst’s ideas to web page design.) If you’re merely interested in getting a quick introduction to typography and fonts, check out Stop Stealing Sheep and Find Out How Type Works, by Erik Spiekermann and E.M. Ginger (Adobe Press).

Finally, Scott McCloud’s book Understanding Comics: The Invisible Art (Harper) is an excellent primer on visual storytelling techniques and much more. It will help you make better slides and handouts, and it is a fun and informative read.