The Evolution of Spidey -- Java, Java, Java's CyberPet
The following episodes in Spidey's life
created using Java applets. Taken together the applets
illustrate the increasingly sophisticated programming skills that are
covered in this book. In the very first stage, Spidey is a very simple
object with two states, eating and sleeping. Spidey will respond to
your "eat" and "sleep" commands. Static images are used to depict
Spidey's eat and sleep states. In the next stage, Spidey displays
some animation when eating. Spidey also performs transformations on
strings that are input by the user. In the next stage, some randomness
is introduced into Spidey's behavior, so that it doesn't always follow
eat when you press the Eat button. In the next stage, drawing commands
are used to draw a scalable version of Spidey. Finally, in the last
stage, Spidey interacts with a separately threaded fly and both
objects behave with random animation.
The first couple of applets are based on material up through Chapter
4. The last example uses advanced concepts that are covered in
Chapter 12. If time permits, you may be able to add even more
advanced stages to Spidey's evolution. For example, one of the
exercises in Chapter 15 is to create a version of CyberPet that can
look up stock quotes on the Internet!
Spidey Baby (Chapters 0-4)
This is me just
after I was born, and this is how I look. I only
knew how to eat and sleep, and I always obey my mother.
Spidey Walks and Talks (Chapters 6-7)
This is me a few weeks later.
I finally learned how to catch flys on my web, and I can chew my food.
Spidey's Terrible Two's (Chapter 8)
Here's me after I
learned to say no. Sometimes I just don't feel like doing what I'm told.
Spidey's Teenage Growth Spurt (Chapters 9-10)
Here's me when I was a teenager.
Spidey the Dreamer (Chapter 13)
Now I'm old enough to decide when to eat and sleep by myself. Mom was
trying to run my life. Here's me dreaming
about a red fly. Who says spiders can't catch a flying fly?