Type-Checking Interface in Ruby
Code: boundaries, experiment, interfaces, POODR, Ruby
Comments Off on Type-Checking Interface in Ruby
One of my favorite parts in Sandi Metz’s excellent Practical Object Oriented Design in Ruby is when she describes how to enforce lightweight interfaces so that multiple objects can play a role reliably. And I thought: how I can I enforce this in a much-more heavy-handed and annoying way?
This question also ties into two ridiculous
tweets of mine:
Code: censorship, Firefox, Mozilla
Comments Off on Prefer: Censorship
In the Mozilla blog post Prefer: safe, I read:
Mozilla believes users have the right to shape the Internet and their own experiences on it. However, there are instances when people seek to shape not only their own experiences, but also those of young users and family members whose needs related to trust and safety may differ.
We’re pleased to announce a smart feature in Firefox for just this type of user called Prefer:Safe, designed to simplify and strengthen the online trust and safety model.
I thought this was encouraging. The “Prefer: safe” was clearly a browser header, and this description sounded like it would indicate to the site the browser wanted increased privacy and security controls, or at least better defaults. I thought it unlikely that a lot of sites would honor it, but maybe it would improve things.
Integration as Composition
Code: Chibrary, composition, design, functional programming, literate programming, pointfree
Comments Off on 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?:
Long-Term Travel Gear List
Comments Off on 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.
Code: domain-driven design, immutability, Ruby, testing, validity
Comments Off on Builder Methods
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
newto 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:
2014 Book Reviews
Life: books, media review
Comments Off on 2014 Book Reviews
I’ve appreciated when people take the time to write reviews and highlight connections to other good works. In the hopes of being useful (and converting my consumption to production), I’m going to try writing and posting capsule reviews of all the books I read this year. 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.)
Two Designs for SequenceIdGenerator
Code: Chibrary, design, object orientation, Ruby, state
Comments Off on 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:
Distributed ID Generation and Bit Packing
Code: bit packing, bit twiddling, Chibrary, concurrency, design, stemwinder
Comments Off on 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.
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.
Ironwood, a Roguelike Game in 7 Days
Games: 7drl, game design, game development, projects, roguelikes
Comments Off on 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.)