Transcription of GDCR 2011 Notes

Herein follows a belated transcription of my notes for GDCR 2011.

Global Day of Code Retreat 2011

I attended the Global Day of Code Retreat (GDCR 2011) on December 3, 2011 in Seattle, hosted by Substantial at their offices on Seattle’s Capitol Hill, moderated by Gary Bernhardt.

Five iterations noted.  I switched pairs every time, and we changed languages.  This used Corey Haines’ format (GDCR 2011 was his global party), with Conway’s Game of Life as the ruleset, TDD and pairing, throwing away code after each iteration.  (I saved some of the code on my machine, but it’s probably not too interesting; I didn’t make use of it on successive iterations).

Iteration #1 Theme: Anything Goes.  Partner: Ken.  Language: Java.

Retrospective #1: Slow getting off the ground.

Iteration #2 Theme: Focus on the rules.  Partner: Scott.  Language: Javascript.

Retrospective #2: Created a “Test” button, used a browser document as the development environment.  Comments from another group: In Scala, the type checker did a lot of the work.

Iteration #3 Theme: Absolute best code.  Partner: Ian.  Language: C#.

Retrospective #3: Used dynamic objects and continuous test plug-in in Visual Studio.  Cleaned up tests. Question from moderator: “what was clean?”  It was okay letting go of (1) getting it done; (2) hesitations regarding quality.  The rules corresponded to the grid.  The core logic corresponded to the web framework.

Iteration #4 Theme: Ping Pong TDD (write failing test, change partners, fix system to pass test, write failing test…), simplest implementation.  Partner: Mark.  Language: Ruby.

Iteration #5 Theme: Avoid conditionals in code.  Partner: Aidan.  Language: Java.

Used enumerated types whose instances had methods.  Treated neighborhoods as different classes, SUSTAIN, BIRTH, DEATH.  Defer the conditional to the neighborhood creation.  Generally people used state machines or matching rules to avoid explicit conditionals.

All the iterations were short enough in time that nobody quite had a working Game of Life implementation.


BreakLife, PongLife

I have the whimsical inspiration to mash up Conway’s Life with Pong or Breakout.  Involving a glider as the ball, and (for Breakout), an array of stable forms as the wall.

For either, there might have to be some way of altering the angle (gliders always travel at 45º to the grid).

For Breakout, the Life rules for the glider pixels can ignore/override the others (though will have special rules to bounce off them and the walls), while the non-glider pixels can use normal Life rules, maybe bounded in an area and/or reflected off them.  Pong might be similar.

What would be the easiest platform to get it off the ground?  And do I have the virtue to TDD it?

Meanwhile my Weatherpixie is nagging at me.  It’s a rare sunny February day, though, and I know I’ll get back to coding after I get out and around.

Catching Up and Code Retreat

The blog has been a little dark while my attention has been elsewhere, but my intentions are still rolling forward, if a bit slowly.

I’ve been to a couple of Seattle Geek Lunches.

I attended the Global Day of Code Retreat (GDCR 2011) in Seattle at the offices of Substantial on Capitol Hill.

In several iterations I pair-programmed implementations of (parts of) Conway’s Game of Life in Java + JUnit, Javascript + alert-if-false, C# and a .NET unit test framework, and Ruby + rspec.  Great fun was had by all.

I’ve started participating in a distributed Hadoop study group based on Cloudera’s sample VM.  Two meetings this January. WebEx seems to work fairly well as a desktop teleconferencing and screen sharing solution.

Nothing new to report on the Weatherpixie prototyping.

Coming up next week: Agile/Open Northwest 2012.

The Path of Least Resistance

In honor of the equinox, I am reshuffling the passwords, double-checking the backups, and rededicating the weblog for the next half revolution.  Akismet was a success, sticking with it.  Upgrading to WP 3.1.  With this post I’m laying down Yesterday’s Weather and inaugurating a new title.

It’s been a quiet fall and winter at Yesterday’s Weather.  I’ve been picking at Javascript regex functions to parse METAR reports but haven’t got a systematic spec and test environment up.  Not much more to report at this point, but it was time for a time-based update regardless.

Now it’s Spring in the northern hemisphere and time to follow The Path of Least Resistance.

New favicon from DeGraeve as before.

Visual Mockup of Weatherpixie

To not let things get too cold, I’m posting a visual mockup in SVG of a weatherpixie-style format.

SVG allows the possibility rendering an up-to-date pixie via textual substitution to activate the appropriate layers and drop in text for the weather report. This allows sidestepping the question of which visual compositing library to use (in App Engine, for example, it’s “bring your own” in Python and even harder in Java due to the blacklist of AWT types).

Click through the static PNG preview to get to the (hopefully identical) static SVG preview.

interactive svg pixie demo (click circles)

Yesterday’s Weather

In honor of the equinox, I am reshuffling the passwords, double-checking the backups, and rededicating the weblog for the next half nano-era.  I’m also trying out Akismet versus the blog comment spam.  With this post I’m laying down The Golden Thread and inaugurating a new title.

Martin Fowler credits the term in a programming context to Kent Beck’s “Extreme Programming Explained”, as a crude yet effective predictor of the future.  Tomorrow’s pace will be about the same as yesterday’s, other things being equal.

I’m also aiming to do some more weatherpixie prototyping and updating a bit more steadily.

It rained today.  It will probably rain tomorrow.

Welcome to Yesterday’s Weather.

Prototype Homage to the Weatherpixie

I’ve been exploring a reimplementation of the Weatherpixie for my own satisfaction.  The various components of the technology stack are around and fairly easy to lay hands on — METAR airport weather reports, METAR parsers, application hosting, image compositing and editing (ImageMagick, at least).

At this point I’m playing with composition using SVG graphics documents plus Javascript as the most fluid format for experimenting with image composition.  SVG + Javascript may not be as versatile a deployment format as the standard Weatherpixie fixed-size graphical image file.  However, it’s easy to play with via Inkscape, Gimp, and a plain text editor.  It has the intriguing possibility of being part of a local application stack able to run without a central pixie server by pulling the METAR fetching and parsing local to the client computer, or hooking it up to some other source of daylight, weather and temperature information.

Attaching a prototype SVG with dimensions based on Tamsin Bowles’ pixie format; not guaranteed to be pixel-precise.  Clicking on this static preview gets you to the SVG:

interactive svg pixie demo (click circles)

Credit to Matthew Bystedt for the SVG paper doll sample in his SVG tutorial; the scripted behavior is based on his general pattern.

Random Points within a Circle

Tuesday July 13th, I visited Seattle Ruby Brigade’s Hack Night on Capitol Hill in Seattle.  It was quiet.  There were many laptops and not much talking from 7 to 9pm.  Quite a change from my old reading group, the Silicon Valley Patterns Group.

With some help from the folks there, I put together a solution for Ruby Quiz #234, Random Points within a Circle.

The quiz this week is to generate random points uniformly distributed within a circle of a given radius and position.

The quiz link:

The comp.lang.ruby thread (via Google Groups):

I followed three ways of projecting one or two uniformly distributed random numbers into the unit circle, then translating and scaling it as prescribed.  I notice that other solutions caught the two ones I thought were obvious, while my third solution seems unique in this small sample, yet visually appears random and is slightly faster, perhaps due to requiring only one random number.

  1. Randomly generate an angle theta.  Randomly generate a radius r from 0 to 1, weighting values toward 1 more heavily to distribute the points evenly across the greater area further from the center.  Return [x, y] = r cos theta, r sin theta.
  2. Randomly generate x and y values from -1 to 1.  If x^2 + y^2 > 1, discard the random point and generate another.
  3. Map the range of the random variable to a tightly wound Archimedean spiral, such that 0 is the point at the origin, and 1 is a million times round and is a point on the circle’s edge.  Generate one random value and return the coordinates of the point which is that far around the spiral.  This ends up, for a spiral equation r = k * theta, that k = 1 / (2 million pi), and the length of the spiral being one million.  Using a random value rand0 in [0, 1] to pick a place on the spiral gives r = sqrt(rand0) and theta = sqrt(rand0) * sqrt (pi * 10^6).

Random points within a circle generated by various methods.

The code which generates the PostScript behind these images:

Heading to Agile Roots

I wouldn’t have thought to mention it here, but as they said: “You have a blog.  Here’s a badge.”

I’ve felt the most satisfied and productive when running with agile software development methods, particularly those close to Extreme Programming. (First edition white-book XP, if it matters).

Hopefully will have some code to add soon.

Agile Roots 2010 - I'll be There

An Appreciation of the Weatherpixie

Tamsin Bowles’ fun little web service, Weatherpixie, has been down since March 2010 when she had server trouble; she has a day job, and her server expert is away.  But I think of her inspired mash-up now and then and keep the pixie link on my Mac dashboard against the day when the service goes back up.  Till then there’s a placeholder at the Weatherpixie home.

The service has an interesting concept (simple pixel doll images that illustrate the weather at some point around the world), a personal hook (Tamsin has designed the dolls around her friends’ clothing styles), obvious behavior (sample pictures on the home page showing a random doll dressed for the weather in three places around the world), and easy participation (a menu-driven system to choose your doll, a map or menu for choosing the weather station closest to your location of interest, and units for wind speed and temperature).

Furthermore, the system has reasonable default behavior when data is missing.  When there is no temperature reported from a weather station, the picture shows the flag of the appropriate country and an indication of whether it’s day or night.

As far as I can tell, the following information goes into compiling a weatherpixie image:

  • Last reported temperature, precipitation, barometric pressure, wind speed and wind direction from the weather station.
  • Current time and date.
  • Weather station’s latitude and longitude.
  • Which pixie was selected or randomly determined.
  • Whether it’s a holiday time interesting to Tamsin and/or her friends.
  • A random factor.

The layers of information composed into the pixie image show:

  • A sky background — light blue for day, dark blue for night, or pinkish or greyish for twilight.
  • Clear, partly cloudy, or cloudy, with rain, snow, or fog if indicated.  Maybe lightning and hail.  Fog is overlaid as wisps or as a scrim on top of the picture.
  • Clothing appropriate to temperature. Different pixies have different numbers of outfits and notions of how much to dress for warmth or chill.
  • An umbrella for rain or snow.
  • A pet dog or cat in the foreground for some pixies.  The position (or presence, for the cat) seems to be random.  Pets don’t dress for the weather.
  • A festive indication of a holiday season (Christmas tree, New Year’s fireworks).
  • A frame with textual representation of the temperature, wind direction and speed, barometric pressure and local time.

It’s not Chernoff Faces, but it’s cute, compact, and direct in how it expresses weather.  It has less obvious affordances; more than once I’ve sat with a child and toured around the world, looking at weather at different stations picked from the world map via the pixie preview.

Attached is one of the more elaborate compositions: a rainy dawn on December 22d, with cat.

Weatherpixie at dawn with cat, umbrella, and Christmas tree

Elaborate weatherpixie composition

An effort like this — and particularly its weeks of absence — makes me itch to get going and roll my own somehow.  Something in the concept and realization grabs me, as simple and apparently transparent as its behavior is.