Generics

I was just settling into a quiet evening of reviewing material for my A to Z class tomorrow when I stumbled across something quite shocking.

Mind you, I was in a fragile state, having finally released myself from a rather unhealthy personal obsession with the StringTokenizer, silently weeping (inside) while adjusting the examples to use split with regular expressions.

Back in the old days, when using some form of Java Collection, one was required to cast elements retrieved from that collection into the type of element stored in the collection. According to Sun’s site: “Besides being inconvenient, this is unsafe. The compiler does not check that your cast is the same as the collection’s type, so the cast can fail at run time.”

Generics allow you to specify the type of a objects to be stored in a collection to the compiler. This means that the compiler can confirm that you are using the collection consistently and cast the values itself as they are taken out of the collection.

What was:

ArrayList strings = new ArrayList();
strings.add("Hello World!");
String s = (String) strings.get(0);

is now:

ArrayList<String> strings = new ArrayList<String>();
strings.add("Hello World!");
String s = strings.get(0);

Frankly, the syntax is a little ugly and awkward (esp. when you start getting into collections with keys and values), but I’ll play along for now. . .

Another trip to Savannah.

Installing "Garden" @ Jepson Center

I’m just finishing up another trip to Savannah, GA. It’s Art & Technology Week here at the Telfair Museum. I participated in two programs, a workshop at the Moses Jackson Community Center and a demo for high school students at the Jepson Center. Haeyoung Kim (who performs under the name bubblyfish) also spoke. I really enjoyed learning about 8-bit music and am interesting in playing around with nanoloop. I hope to catch some of her performances in New York!

I also installed my new work, Garden. Oh geez, I just used Youtube again.

Simplicity

In the interest of trying to lead my life according to my recent minor obession: John Maeda’s Laws of Simplicity, I have decided to start off the Spring semester with a little bit of law 1: Reduce.

So out with http://www.shiffman.net/teaching/the-nature-of-code/

and in with http://www.shiffman.net/teaching/nature/

and out with http://www.shiffman.net/teaching/programming-from-a-to-z/

and in with http://www.shiffman.net/teaching/a2z/.

Apologies if this makes your browsing temporarily complex.

The Garden

It’s been a while since I published a new work. But there’s nothing like a deadline. A year ago, I installed three of my works at the Jepson Center for the Arts in Savannah, GA. Since the installation was set to run for three years, it seemed like a nice, altogether reasonable thing to say “Well, how about in a year, I come back and swap out one of my old pieces for a new one?” A year quickly fills up with teaching, working on a book, and living la vida loca. Nevertheless, here I am, a week from heading back down to Savannah and spending all day programming again.

When I first developed the two generative pieces, swarm and mosaic, I always imagined them part of a series of three. I was working on my ITP thesis, an exploration of generative systems in the production of real-time non-photorealistic imagery. Flocking. Cellular Automata. The usual. Having only one semester, I never made it to adopting their formulaic sibling, Fractals (I think I might have to name a pet Fractals some day, kind of like Freckles, only nerdier.) Looking at how L-Systems work (which we do in my nature of code class), the idea was to create a generative garden of abstract and algorithmic trees, shrubs, and flowers, growing on and about the screen, creating a nice little digital painting of the viewer.

Some screenshots and a video (first one is me, second one is my dog, Petey “Fractals” Caloyeras):

garden garden

I’m not entirely satisfied with the result, as of yet. It’s nice to look at, but it’s just the swarm effect duplicated, only instead of smearing pixels with in a flocking pattern, they are smeared in a recursive tree pattern. I like to keep things simple, but perhaps augmenting the interaction in such a way that, at the very least, the viewer has a sense of “planting seeds” might improve the experience. I also intend to try some more sophisticated plant patterns, but with only one day of experimenting, keeping it simple for now. . .

Ok, so I will probably go back to using the video comments plug-in for posting video, but how could I live one more day without at least publishing one video to YouTube??