Over the Christmas Break, I came across a fabulous textbook called “The Nature of Code.” The author (Daniel Shiffman) provides an online copy of the text, with source code and interactive examples free of charge. Check out the text here.
You can get a paper copy of the text for around $30 or a full PDF copy of the text (with source code for all examples) for a recommended donation of $10 (although he lets you set your own price).
Anyway, this book is one of the best (if not the best) textbooks for teaching computer programming I’ve ever come across. The focus throughout is on simulating natural processes. Check out these topics:
- Random Processes & Noise
- Using Vectors for Modeling Physics
- Physics Forces as Vectors
- Simulating Oscillating Systems
- Particle Systems
- Physics Libraries
- Autonomous Agents (modeling forces within)
- Cellular Automata
- Genetic/Evolutionary Programming
- Neural Networks
We are now in week 4 using this book and it seems that my feelings are vindicated. My students are loving the book and creating some wonderful simulations… which they are sharing on their blogs.
I am working through the class along with my students. Below is a link to what I’ve done so far. I call it “Dr. Brown’s Funky Forest.”
This is what I did for my “Funky Forest.” It is supposed to illustrate the use of Perlin noise to model natural looking randomness (in the insects movements), physics modeling of movement and acceleration, and it has two classes of insects that are attracted to different things. The smaller insects are interested in the flame. The larger insect is interested in the smaller ones.
The Sketch doesn’t look exactly like it does running it on my home computer. The flame is flickering above and beside the torch to which it belongs and my easter egg doesn’t work (clicking the torch flame should show movement trails of the insects).
Processing allows you to export your program to run on Android devices and this sketch looks great running on my Galaxy Tab 2 running 4.1.1 Jelly Bean.
Anyway, I’m pretty impressed with Processing and with Daniel Shiffman’s book “The Nature of Code.” Again, check out the work my class is doing throughout this semester. They are impressing me every week!