Integration as Composition

I’m puzzling over the design for a worker and would appreciate your comments on it. I started with the pain of an ugly test, made an interesting refactoring, and decided to drop the test entirely, but I’m not at all sure this is the right decision.

In my mailing list archive Chibrary, I want to sum up the number of threads and messages in a month to present on archive pages. The MonthCountWorker takes a Sym, a unique identifier for a list’s slug + year + month, fetchs the threads for that month, sums them, and stores the sum. The code is trivial, right?:

Continue this post…

Long-Term Travel Gear List

Recently I was pontificating at Kori Roys, a coworker who’s recently departed for some long-term travel, about what to bring and how to pack it. I gave him the highlights and promised to publish the full list. Well, that took enough time that he got under way — because it’s over 3,000 words. I had to put a fair amount of thought into traveling with just a small backpack, and I’m happy to share it now.

Here’s my Long-term Travel Gear List. I’ll be keeping it updated as I continue to tweak it, and I’ll publish a new blog post if and when I feel significant changes warrant it.

Posted in Life at 2014-06-10 03:53 | No comments | Tags:

Builder Methods

I was reading Corey Haines’ book Understanding the Four Rules of Simple Design (capsule review on the 2014 book reviews post) when I read:

In fact, over time I’ve developed a guideline for myself that external callers can’t actually use the base constructor for an object. Put another way: the outside world can’t use new to instantiate an object with an expectation of a specific state. Instead, there must be an explicitly named builder method on the class to create an object in a specific, valid state.

This was a brief aside at the tail of a longer discussion of interdependent and redundant tests. It really caught my attention and I’d like to hear it more thoroughly investigated. In the hopes of attracting Corey’s attention, I offer this cat pic and an exploration of the benefits of a similar practice I have:

Continue this post…
Posted in Code at 2014-04-29 01:32 | 3 comments | Tags: , , , ,

2014 Book Reviews

I’ve appreciated people who take the time to write reviews and highlight connections to other good works, so I’m going to try writing and posting reviews. I’m posting this live on April 20 but plan to update this post through the year. (I figure if I can make it three months I’ve got good odds for finishing the year.)

Continue this post…
Posted in Life at 2014-04-21 00:41 | No comments | Tags:

Two Designs for SequenceIdGenerator

In my previous, marathon post on id generation, I mentioned that I was generating unique sequence numbers. It was straightforward to write a class to generate them:

Continue this post…
Posted in Code at 2014-04-18 20:13 | 1 comment | Tags: , , , ,

Distributed ID Generation and Bit Packing

There are two ways for programs to collaborate: they can communicate their shared state or they can partition the work so they don’t need to know each other’s state. As I’ve been rehabbing the code for my mailing list archive Chibrary I ran into this issue, and the design constraints made for an interesting puzzle. I need to generate unique IDs in multiple programs at once, and they need to be short enough to fit in URLs.

Writing is nature’s way of letting you know how sloppy your thinking is. Guindon

At more than 3,000 words, this is an unusually long blog post for me. This problem has a lot of considerations to balance (and you’ll see a lot of parenthetical caveats). I like to work through problems by writing out my thoughts, constantly tinkering with possibilities and revisiting ideas in light of new constraints or insight. I thought my (heavily) revised notes might make for an interesting post as I attack the problem from several different approaches and end with a solution that nicely connects theoretical and practical considerations. As a bonus, maybe someone will tell me I’m approaching this all wrong or ignorant of a known best practice for this sort of thing before I go live. With that preamble rambled, let’s dig into the problem.

Continue this post…
Posted in Code at 2014-04-14 14:59 | 2 comments | Tags: , , , , ,

Ironwood, a Roguelike Game in 7 Days

Ironwood is a roguelike game developed for the 2014 7 Day Roguelike Challenge. “Roguelike” is a pretty poorly defined genre, but generally speaking it’s a turn-based game with generated environments, emergent gameplay from simulationism, and a steep learning curve. (For more, see an informal definition, a formal attempt, or a current take on its broad use.)

Updated 2014-04-07: You can play Ironwood in your browser right now! Big thanks to Snarky for the Javascript port: Ironwood

Continue this post…

Posted in Games at 2014-03-19 21:26 | 3 comments | Tags: , , , ,

Extracting Immutable Objects

In the last few weeks I’ve been rehabilitating some of the first object-oriented code I wrote in the hopes of bringing my mailing list archive back online. Lately I’ve been refactoring some of the earliest, core code: the Message class. It manages the individual emails in the system and, because I didn’t understand how to extract functionality, had turned into something of a God Class.

Yesterday I tweeted about a really satisfying cleanup:

tweet Continue this post…

CTF Liveblog


It’s on Friday afternoon and time to start working on Capture the Flag game. After chatting with friends I have some vague title/theme ideas. In the sprites there’s this row of pieces that look like a broken crest:

crest pieces

I’m not really sure what they’re supposed to be, but they prompted some theme ideas that fit with teams playing CTF over and over on random maps. Maybe there was a great evil sealed away that has broken free. It was defeated, but its wild magic broke the world into ever-changing pieces. Which is not so bad as things go, but it would be nice to put things back together again. There’s a bit of a tragedy of the commons, though – whoever is the one to reassemble the seal to fix the world will have the power to shape it, so rival groups (families? clans? guilds?) are trying to take the pieces away from each other and remake the world to their design.

Continue this post…
Posted in Games at 2013-08-09 18:23 | 2 comments | Tags:

Random The Flag

Oryx 16bit Fantasy Characters

I’m going to spend next Friday to Monday making a game. I was inspired by Oryx’s 16bit sprites, they’re a beautiful, cheap resource for game prototyping (the license is a bit confused for business purposes). I’ve been wanting to (and failing to) make games for years, so I’m going to ensure I succeed by defining the game by the time I spend rather than the infinitely long wish list plan I can invent.

Continue this post…
Posted in Games at 2013-08-04 14:08 | 7 comments | Tags: , ,
  • Twitter: pushcx

    • When I make test users, I name them Alice, Bob, Carol, etc. I solved this bug on Kirk... after wrapping around the alphabet.
  • More tweets below and @pushcx