Coding Like You Mean It
From BenningtonWiki
Bennington College, Spring 2006
Joe Holt, Computing
Contents |
[edit] DESCRIPTION
What’s it like to write shipping software? In this course you’ll experience the complexities of working on large programs and see Computer Science played out for real in thousands of lines of cutting edge code. You’ll use as your textbook the source code for several large freeware and open source projects. By dissecting, debugging and rewriting them you’ll experience fundamental algorithms and data structures in true context. In the process, you’ll get involved in the phenomenon of open source software development, contributing bug fixes and taking part in forum discussions with colleagues around the world. Intermediate programming knowledge of C is a requirement (passing grade in a previous class or equivalent experience).
[edit] NOTES BY WEEK
[edit] May 23 (#13)
- Due: Read A Short Introduction to the Art of Programming and A Parable by E.W. Dijkstra.
- Due: Double linked list library.
[edit] May 16 (#12)
- Due: eightqueens.c implementation.
- Next up: a double linked list library.
- Find some in the Quake code.
[edit] May 9 (#11)
- Due: Put S_HashSFXName() in the workbench and learn as much as you can about it.
- Maybe learn about hashes.
- Headers, libraries.
- Discuss: Wirth.
- Create a header for 8 queens, assign the implementation.
[edit] May 2 (actually May 5) (#10)
- Due: Finish assignments from last week:
finding lists,Wirth reading, NerdTV. -
Due: List implementations. (I'll write up the spec soon.)No, we'll do the list coding in class.- Start with pointers.
- Move to malloc.
- Move to structures and malloc'ing structures.
- Sidetracks to stacks, VM, code generation.
[edit] April 25 (#9)
- Due: Find three examples of lists within the Quake sources. Document your findings here.
- Due: Read Program Development by Stepwise Refinement by Niklaus Wirth, 1971. Be prepared to discuss.
- Due: Watch an episode of NerdTV and write a paragraph about why the person is (or isn't) important. Pick one that hasn't already been written up. The videos are on cs0. Write them up here.
[edit] April 18 (#8)
- Due: Read There's Plenty of Room at the Bottom by Richard Feynman.
- Due: Document ten Quake cvars. Make particular note of any idiosyncrasies.
- Due: Document ten commands. Note in which source file each is implemented.
- Due: Make at least two check ins.
- Discuss: GENERALIZE. Take the specific examples of things we've learned in Quake and formulate general CS principles out of them.
- Discuss: Summer of Code.
- Discuss: Summer job.
- fib.pl and LM3000 Fibonacci Numbers.
- I think we need to learn about svn branching.
[edit] April 11 (#7)
- SEPC
- Due: Settle on a working environment for your code.
- Due: Check out Quake from svn.
- Due: Read README.txt. Find out about the open source libraries mentioned there.
- Due: Build and run Quake 3.
- Due: Examine the Quake 3 debug info in stdout (the run log window in XCode).
- Extra Credit: Fix the "Out of Ammo"-even-when-you-have-ammo bug. EXTRA CREDIT TO JOE!
- Forrest talks about security (bring blankets).
- Discuss: Bug tracking.
- Discuss: what gets checked in; how to avoid destroying the code tree.
- Explore: Source level debugging.
[edit] April 4 (#6)
- Due: Eben, installing pkgs from the command line; other methods.
- Due: Get through vimtutor
- Due: Apache / Server team installs mod_apache_svn
[edit] March 28 (#5)
- Due: Read Chap 2 of the svn book.
- Due: Read the Richard Stallman ZNet Interview.
- Discuss: ?
- Windows XP Network Home Dir support? Max
- Begin taking Quake apart and seeing how it ticks.
- Copy quake3-1.32b.zip from ~jholt/Public.
- Set target executable.
- Choose original Quake folder on first run.
- svn workouts.
- Move Quake code to svn.
[edit] March 21 (actually March 24) (#4)
- Due: Apache combined log format.
- Due: Wiki set up.
- Discuss: The lameness of URLs.
- networked home dirs.
- svn intro.
- Coding! Like we mean it!
- Write a Perl command line program?
- Perl email?
[edit] March 14 (#3)
- Due: Everyone learn about bash, the Bourne Again Shell
- Due: Everyone learn about cat
- Due: Everyone learn about less, the better version of more.
- Server team report.
- Apache team report.
- Eben and VNC.
- Forrest and nfs.
- Apache logs, conf.
- Regular Expressions
[edit] March 7 (#2)
- Due: rm override by Mike, NTP by Ang, bc by Forrest, rcp and rsync by Owen. Did I miss anyone?
- Show and tell things people did on cs0, command line, etc.
- Create server team.
- Investigate every running process on cs0.
[edit] Feb 28 (#1)
- First class.
- Set up class server.
[edit] CLASS TEAMS
- Server team
- Angela
- Mike
- Apache team
- Xam
- Forrest
- Owen
- Wiki team
- Aurora
- Security team
- Forrest
[edit] TRICKS AND TIPS
[edit] SSH With Keys (Without Passwords)
- Step One: First, create a pair of keys *on your local computer*.
- If you're on an Apple use: ssh-keygen -t rsa
- It will prompt you three times - hit Enter for default for all of them.
- Both files will be saved in .ssh/
- If you're on a PC, you're probably using Putty's !PuttyGen.
- Make sure the DSA option on the bottom is selected.
- Leave the passkey boxes blank and generate your keys.
- Save each key. Remember where you put them!
- If you're on an Apple use: ssh-keygen -t rsa
- Now, transfer the public key (id_rsa.pub) to the *remote computer*.
- On your home box: scp .ssh/id_rsa.pub !user@host.com:~/.
- This will transfer id_rsa.pub into the remote user's home directory.
- If you're on a PC, use !PuttySCP. Use the same command, but with pscp instead of scp.
- Again, for PC users, replace .ssh/id_rsa.pub with wherever you saved your public key.
- On your home box: scp .ssh/id_rsa.pub !user@host.com:~/.
- Next, add the key you have transferred to your list of authorized keys *on the remote computer*.
- First, make sure ~/.ssh exists.
- Then add the new key to your list of keys: cat id_rsa.pub >> .ssh/authorized_keys
- If you're using Putty you should also: ssh-keygen -i -f id_rsa.pub >> .ssh/authorized_keys
- You don't need the id_rsa.pub file anymore: rm id_rsa.pub
- Make sure only the user can see inside the .ssh directory: chmod 700 .ssh
- If you're a Mac user, you're done! Just ssh !user@server.com.
- If you're using Putty, you'll need to remember where your private key is and do plink !user@server.com -i c:\id_rsa.
[edit] One Line C Programming
echo -e '#include <stdio.h>\nint main() {printf("Hello, world!\\n"); return 0;}' | gcc -x c -; ./a.out
[edit] Cygwin: The PC User's Command Line Holy Grail
I actually haven't tried it out yet, but the very concept of Cygwin, a port of the most commonly-used BASH functionalities (including GCC, Make, SSH, etc.) excites me significantly. More news when I've installed it and played around with it.
[edit] OPEN SOURCE PROJECTS
[edit] Zork
- Zork: A Computerized Fantasy Simulation Game.
- How to fit the Great Underground Empire on your desk-top.
- The History of Zork.
- The Z-Machine Standards Document.
- Frotz Z-machine interpreter on SourgeForge.
- ztools including txd, a disassembler (ztools731.tar.gz is the sources, and make just works).
- Inform example programs, including Advent.
- Gamasutra - The History Of Zork
Some articles to find:
- "Zork: A Computerized Fantasy Simulation Game," IEEE Computer, April 1979, pp. 51-59.
- "Participatory Novels," The New York Times BOOK REVIEW, May 8, 1983.
- "Computers: Putting Fiction on a Floppy," Time, December 5, 1983, p.76.
- "TECHNOLOGY: Zorked Again," Newsweek December 23, 1985, p.70.
- Text versions of many contemporary articles.
[edit] mt-daapd
[edit] VNC Software
[edit] Scumm VM
[edit] Quake 3
Quake 3 Dev Notes.
Quake 3 Bugs.
Here are my notes on getting Quake 3 compiling on OS X (including some simple but extremely entertaining modifications).
A Quake family tree.
- Slashdot- Quake 3: Arena Source GPL'ed
- Quake 3 Files - Planet Quake
- Index of /pub/idgames/idstuff
- Quake3World.com Forums - Index
- GtkRadiant for mac :: Index
- Quake3World.com Forums - View Forum - Macintosh Discussion
- The Quake3 Networking Model
- Quake Standards Group - News
[edit] OpenOffice or vim
Or some such word processor.
[edit] devkitARM
For fun.?
[edit] OpenEEG
monitor brainwaves
[edit] NETWORKED HOME DIRECTORIES
I want to set up network accounts for the students in the class. Actually I think the entire school should have them. We used networked home dirs at Apple and it was fairly reliable and stable (so long as the network stayed up). But I don't know enough about how to do it to lead a school-wide effort -- so let's learn in this class.
The vision is: a student can sit down at any of the computers in the pod and log in using their network-wide name and password. It doesn't matter which computer they use. Once logged in, they get their desktop, their files, everything, as if that were their computer. This is accomplished by storing their home directory on a network file server and enabling network-wide logins on the machines in the pod.
Questions: NFS or AFP home directories? I remember there was grumbling about AFP home directories at Apple. IT had switched everyone from NFS to AFP. NFS had seemed to work fine. After the switch a lot of glitches turned up, and people started requesting a switch back to NFS. IT did this on a per-request basis. I don't remember the problems, but a quick scan of the net shows a similar opinion of AFP home dirs (e.g., here).
[edit] VERSION CONTROL
We're going to set up a version control system. I have used CVS and Perforce and Sourcesafe. I'm leaning toward setting up a CVS server on kvalda. However Subversion is looking like a better alternative. I see it used on a lot of newer open source projects, and from a glance at the website and documentation it looks like it may well be a good successor to CVS.
Subversion web site.
Subversion FAQ.
Version Control with Subversion book.
Ooh! Getting Control with Subversion and Xcode.
A subversion package installer for OS X (subversion v. 1.3) can be found here. Installation requires admin privileges and puts the components in /usr/local/.
SVN Notes: Wiki page on the use of Subversion.
Here are the beginnings of lecture notes on versioning and svn.
[edit] BUG TRACKING
I want to use a bug-tracking system and get the students used to tracking their work in this way. We can hack something simple, like with a bunch of wiki pages. Or we can use Bugzilla, I suppose. I'm not familiar with it, but it looks capable.
Update: Bugzilla is gross.
- Xam Says:* I found another bug tracker called Trac. Apparently it works well with Subversion.
[edit] HARDWARE AND SOFTWARE
We should get a dedicated server for svn and other course hacking.
- Macintosh with gigabit ethernet
- OS X Server
- Apache, ssh, mail, svn
- LDAP for network accounts
- Network account storage? Or use vapastudents.
- Single admin account. Students use their network accounts when ssh'ing in.
Client machines (Pod computers, etc.):
- Admin account for installations, etc.
- Directory Access set up for LDAP authentication from svn server.
- Can we create an admin account in LDAP?
- Software
- Developer tools
- BBEdit
- svn client
- iTunes (for mt-daapd work)
- Quake 3 binary
- Is that it?
[edit] THINGS TO LEARN™
In the last four weeks of class:
- Bit manipulation
- Getting good at logical expressions
- Finite state machines
- Memory management
In no particular order:
- remote logins
- regular expressions
- bash (history, environment, piping, etc.)
- command line tools (less, grep, bc, cron) --> http://www.ss64.com/bash/ is a good command resource
- command line text editors (vim/vimtutor, pico, emacs)
- open source repositories (sourceforge, darwinports)
- code checking in, checking out (cvs, svn)
- debugging with gdb - yahoo!
- linked lists, double linked lists
- hashes, hash tables
- random number generation
- floating point representations
- perl (yikes)
- malloc/free and pointers
- file i/o
Hey, I know this is crazy, but can we get code running right on the metal on a full blown computer without an operating system getting in the way and its overhead? Maybe that is just a masochistic idea. At least we can talk about it. Can we make a hello world that the computer boots into, without any intermediate operating system? To me, that would be amazing. -- Forrest
[edit] PEDAGOGICAL MINUTIAE
What am I doing here? I'm a programmer!
Create teams / groups around the different lumps of technology:
- svn / viewVC / WebSVN
- network home dirs
- wiki
- mp3 format
- sql
- https
- openGL
- newtonian physics
- character AI
- etc.
Here's how we work:
- Learn a concept
- Find examples in the code
- Write your own
Periodic readings (from Words list below) with 256-word reflective essays.
Man-ly assignments for new command line tools: read man page, try it out, write summary and examples.
Projects. Everyone works on something. You can work together in a team, or you can work alone (be a team of one). Every team presents.
For minor assignments (e.g., practice regexps), everyone works alone, and a few will present. There might be something to post.
For CS coding assignments, give the API. Students implement it. Use a testbench to confirm functionality, assess performance, and test it under abuse.
[edit] LESSON NOTES
- Setting up the server.
- Version control and Subversion.
- Security updates.
- Getting Quake 3 compiling on OS X.
- List Lesson Notes.
- Pointers Lesson Notes.
- Hash Lesson Notes.
[edit] WORDS
- A Short Introduction to the Art of Programming by E.W. Dijkstra, 1971.
- Program Development by Stepwise Refinement by Niklaus Wirth, 1971.
- Richard Stallman interview in ZNet, December 18, 2005.
- Bruce Perens speech at the UN World Summit on the Information Society, November 18, 2005.
- The GNU Manifesto.
- There's Plenty of Room at the Bottom by Richard Feynman, 1959.
- MySQL build process, p.48 of MySQL 4.0 Reference Manual.
- Ray Kurzweil on The Singularity.
[edit] HEROES
- Donald Knuth (1938-)
- The Art of Computer Programming, Volume 1: Fundamental Algorithms
- The Art of Computer Programming, Volume 2: Seminumerical Algorithms
- The Art of Computer Programming, Volume 3: Sorting and Searching
- The Art of Computer Programming, Volume 4A: Enumeration and Backtracking
- The Art of Computer Programming, Volume 4B: Graph and Network Algorithms
- The Art of Computer Programming, Volume 4C: Optimization and Recursion
- The Art of Computer Programming, Volume 5: Syntactic Algorithms
- The Art of Computer Programming, Volume 6: Theory of Context-Free Languages
- The Art of Computer Programming, Volume 7: Compiler Techniques
- Niklaus Wirth (1934-)
- Edsger Dijkstra (1930-2002). Archive
- Claude Shannon (1916-2001)
- Alan Turing (1912-1954)
- Richard Feynman (1918-1988)
