Here’s an abstract description of a coding pattern in the Ruby language.
I often find myself uncomfortably coding an alternation like this one.
Now, moving details of the edge-case behavior into its own method is great, because it lets me concentrate on it in a context where it isn’t a distracting detail.
But creating this context has cost me; I don’t like the code for act, because most of it is about things other than the natural implementation, which is hiding off in another method.
Yesterday in Noel Rappin’s “Getting Started With Rails Testing”, I saw a concrete example of another formulation that I prefer.
(My #footnote is that in the unlikely scenario where the natural implementation of edge_case_step_2 can evaluate to false, you’ll need to stuff some extra truth in there somehow.)
I like this because it reads naturally, and is shorter due to the abbreviating power of the Perlish “and” for conditional actions.
[tag: software_development]
I recently did a little rewiring of the technologies behind the on-line representation of me. Almost certainly unwarranted given how little watched and how inactive I am, but it means this post gets an apt title, and the approaches were interesting for their own sake.
Firstly, a little vanity. I’m pretty happy using anthonybailey.net as
my home on the Net, but it can be incoveniently long sometimes. So I registered antb.me/ as a tiny URL vanity domain, and wired up my blog framing machinery so that I can shorten e.g.
http://anthonybailey.net/tumblelog/2009/03/30/a-happy-accident-memetics-and-pairing to
antb.me/t214 if I want to.
Secondly, some aggregation. I display a
headlines summary as part of my homepage. This used to be generated from a special-purpose merge of my blog and tumblelog feeds, but I am a little active on sites that I don’t own as well, and activity streams are all the rage. So, now it’s powered by a
FriendFeed blend of these blogs together with comments tracked by the excellent
Disqus and
BackType services. (This is still imperfect. Ideally, FriendFeed wouldn’t abbreviate my blog content and then
the feed itself would be a more useful read. Actually, ideally
trackback would have caught on enough that I could comment on other blogs by posting on my own, but that wishful distributive thinking just hasn’t worked out.)
<dl>
<dt>space elevator pitch</dt>
<dd>
When a "great new business idea" takes
so long to describe you know it can't work.
</dd>
</dl>