CompSci 141 / CSE 141 / Informatics 101 Spring 2013
Code Examples


Code examples, from lecture and otherwise

Over the course of the quarter, when I write substantial code examples in lecture — beyond just experimentation or short code fragments — I will be turning them into full-scale code examples and posting them here for you. Be aware that there is a processed involved in fleshing out a lecture example — rather than just posting code exactly as we wrote it, I'd like to turn it into something more complete and instructive — and this process takes some time, so it's best, in general, not to expect these to be available right away, but I will generally try to have them available before the next lecture, at the latest.

Note that you are not permitted to copy and paste any of this code into your own projects unless it's specifically been allowed, but, of course, the techniques employed may also be of general use to you in your work. These examples are intended to give you clean, well-documented examples of some of the things we cover in lecture (and possibly a few things that we don't, time permitting), so that you can be free in lecture to avoid trying to take detailed notes when we're writing code together, instead concentrating on understanding the process and the bigger-picture concepts at work.

Lecture Date(s) Description
Tu 4/16 A generic, iterable implementation of a stack in Java
Tu 4/30 A few Haskell examples from the first lecture on Haskell
Th 5/2 Exploring Haskell more deeply
Th 5/9 More about Haskell functions, function composition, and infinite recursion
Tu 5/14 An implementation of a stack ADT in C++ without using classes
Tu 5/28 The AnnoyingKid example of multiple concurrent threads and interruption
Th 5/30 The JabberingThreads exploration of the monitor in each Java object — synchronized, wait, notify
Th 5/30 The BlockingQueue, an example of a concurrent data structure that can be shared safely amongst threads