<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title>DABlog - Home</title>
  <id>tag:dablog.rubypal.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  
  <link href="http://dablog.rubypal.com/" rel="alternate" type="text/html" />
  <updated>2008-10-03T21:15:36Z</updated>
  <link rel="self" href="http://feeds.feedburner.com/rubypal/KoEa" type="application/atom+xml" /><entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-10-03:233</id>
    <published>2008-10-03T21:14:00Z</published>
    <updated>2008-10-03T21:15:36Z</updated>
    <category term="Coolth and Weirdth" />
    <category term="Events" />
    <link href="http://dablog.rubypal.com/2008/10/3/why-i-am-suspicious-of-the-bailout-bill" rel="alternate" type="text/html" />
    <title>Why I am suspicious of the bailout bill</title>
<content type="html">
            &lt;p&gt;The bailout bill has just passed. I know very little about economics, little enough that I don’t feel entitled to a strong opinion one way or the other on whether the bill should have passed. But I am suspicious of it.&lt;/p&gt;


	&lt;p&gt;I’m suspicious of it, for one thing, because of the fear-mongering that has surrounded it; it’s very reminiscent of the ongoing “Terrorists will come and kill your family if the executive branch doesn’t get a blank check for waging undeclared war” campaign, and things in that vein.&lt;/p&gt;


	&lt;p&gt;But I’m even more suspicious of the bill because of all the rhetoric about how it will help “Main Street” as well as “Wall Street”. I don’t know whether it will or not, but what troubles me is the fact that this kind of rhetoric makes it sound like Congress and the Bush administration are desperate to help Main Street. The fact is that, in general, they’re not.&lt;/p&gt;


	&lt;p&gt;Every microsecond of every day in the history of this country there have been uncountable opportunities for the government to help citizens with financial problems, difficulty paying for a home, lack of job opportunities, inability to get credit, and all the rest of it. The thrust of the behavior of the government for most of the history of the country has been not to bother helping such people to any significant degree.&lt;/p&gt;


	&lt;p&gt;Now, all of a sudden, helping Main Street leaps to the front of the congressional and executive agenda. I’m disinclined to buy it. If the common weal were really a government priority, we would have known by now. I find it immensely suspicious that the greatest outpouring of social concern, at least as measured in money, comes tethered to a Wall Street bailout.&lt;/p&gt;


	&lt;p&gt;If Main Street is going to benefit from the delivery of a de facto blank check to Wall Street, surely it would not benefit any &lt;i&gt;less&lt;/i&gt; from having money delivered to it directly. But you don’t hear any talk of, say, the government purchasing houses for the victims of fiscal mismanagement. I suppose it would have taken too long to draft a bill that did that; and as we know, the earth would have left its axis if the bill had not been passed this week….&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-09-13:219</id>
    <published>2008-09-13T10:00:00Z</published>
    <updated>2008-09-13T10:05:23Z</updated>
    <category term="Computers" />
    <category term="Events" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/9/13/tracks-a-go-go-at-rubyconf-2008" rel="alternate" type="text/html" />
    <title>Tracks a-go-go at RubyConf 2008!</title>
<content type="html">
            &lt;p&gt;&lt;a href="http://www.rubycentral.org"&gt;Ruby Central&lt;/a&gt; is gearing up for
&lt;a href="http://2008.rubyconf.org"&gt;RubyConf 2008&lt;/a&gt;, which has a
fantastic program and which you can still 
&lt;a href="https://www.regonline.com/rubyconf2008"&gt;register for&lt;/a&gt; (at
time of writing, anyway!).&lt;/p&gt;


	&lt;p&gt;People have noticed, naturally, that we’ve gone over entirely to a
multi-track format (except for keynotes and a couple of other special
slots). And they’re surprised; we used to be one-track, and then last
year we were multi-track but with a good dose of plenary sessions.&lt;/p&gt;


	&lt;p&gt;So I thought I’d say something about the multi-trackedness of RubyConf
2008, for anyone who’s interested.&lt;/p&gt;


	&lt;p&gt;The bottom line is that we’ve scheduled multiple tracks because we
got so many really, really good proposals. Of course we can’t accept
all of them; we can’t be &lt;em&gt;that&lt;/em&gt; multi-track.  There will always
be a cutoff, and where the cutoff comes always involve a judgment
call. This time around the judgment was that the number of talks we’d
have to exclude, in order to dilute the multi-trackedness
significantly, was too great.&lt;/p&gt;


	&lt;p&gt;In fact, we started drafting a schedule without explicitly discussing
the multi-track issue; it mostly emerged from what we jotted down, and
then it continued to make sense to us as we started analyzing the
track issue more closely.&lt;/p&gt;


	&lt;p&gt;People have asked whether it’s about the size of the event. It is, in
a couple of ways&amp;mdash;subtle ways, perhaps, but important.&lt;/p&gt;


	&lt;p&gt;For one thing, we know that not every speaker is comfortable getting
up in front of 500 people. Lots are, but it’s still a lot to ask.
Breakout sessions make for situations in which more speakers are
likely to be comfortable.&lt;/p&gt;


	&lt;p&gt;Of course, if there are only fifteen speakers, we could easily find
people who don’t mind a big audience. But what about that “only
fifteen speakers” thing?&lt;/p&gt;


	&lt;p&gt;In a conference with 400-500 people present, it’s definitely more fun
if, say, twelve percent of the people prowling the halls and sitting
next to you at lunch are speakers, instead of two or three percent.
Having fifteen speakers at an event with over 400 people isn’t the
same, for anyone, as having fifteen speakers at an event with sixty
people. If the ratio is too lop-sided, it gets too much into the “us
and them” thing. We’ve never been into that.&lt;/p&gt;


	&lt;p&gt;Another reason we’re OK with moving toward a multi-track format is the
proliferation and success of the Ruby regional conferences, many of
which are one-track. Everyone should attend, at some point, a
one-track conference. It’s really cool the way everyone at such a
conference shares the same experience. My first conference was a
one-track academic film conference in 1985, and it was great. 
And the wonderful flowering of the Ruby regional conference culture
means that, even if it isn’t at RubyConf, many Rubyists will get a
chance to have that experience.&lt;/p&gt;


	&lt;p&gt;We started our regional conference grant program in 2006 in the hope
that “regional” wasn’t going to mean “provincial”&amp;mdash;that regional
conferences could be top-notch events&amp;mdash;and that hope has been
fulfilled beyond what we could possibly have wished for. (And
certainly way beyond what we can take credit for. The regional 
organizers have been amazing!) These high-quality small events can
address many needs and desires, including the desire for the
experience of a one-track format.&lt;/p&gt;


	&lt;p&gt;In sum, the RubyConf format for 2008 is a format for its time, its
year, its configuration of the Ruby world. We’re nothing but excited
about it and hope you’ll come and share the fun!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-09-06:216</id>
    <published>2008-09-06T08:07:00Z</published>
    <updated>2008-09-06T08:08:47Z</updated>
    <category term="Computers" />
    <category term="Events" />
    <category term="Ruby" />
    <category term="Travel" />
    <link href="http://dablog.rubypal.com/2008/9/6/back-from-railsconf-europe-2008" rel="alternate" type="text/html" />
    <title>Back from RailsConf Europe 2008</title>
<content type="html">
            &lt;p&gt;I got home yesterday from &lt;a href="http://en.oreilly.com/railseurope2008/public/content/home"&gt;RailsConf Europe 2008&lt;/a&gt; in Berlin, and am very happy to say that the event was a major success.&lt;/p&gt;


	&lt;p&gt;It was particularly gratifying to hear from many attendees that they found the program content more advanced and more instructive than last year. It’s always hard to fine-tune the level of talks across a big program like this, and I’m really glad to have evidence that people overall felt it had gone in the right direction.&lt;/p&gt;


	&lt;p&gt;Highlights included keynote addresses by David Heinemeier Hansson and Jeremy Kemper, as well as a Rails core team panel discussion with David, Jeremy, and Michael Koziarski. &lt;span class="caps"&gt;DHH&lt;/span&gt; led us through some very interesting thoughts on the notion of “legacy” code, and how that concept plays out with respect to one’s own development and growth as a programmer. Jeremy talked about performance, and masterfully expanded the horizon beyond the shop-worn “Does Rails scale?” stuff to some very specific and powerful techniques for evaluating and adjusting performance.&lt;/p&gt;


	&lt;p&gt;We also held a “Symposimi” (the name is based on a misspelling in the program; it should have been “Symposium” but came out “Symposimi,” and I decided that sounded really cool!) on the subject of Ruby versions and implementations&amp;mdash;who’s using what, what’s targeting what, the pros and cons of moving to 1.8.7 and/or 1.9. A symposimi is a town-meeting-like gathering of people who want to ask and answer questions about a topic. It’s more audience-based than a symposium, and less hierarchical.&lt;/p&gt;


	&lt;p&gt;The symposimi was fun for me because I got to do some live code demos, which I usually don’t at the conferences I’m an organizer of!&lt;/p&gt;


	&lt;p&gt;Lots of people asked about next year. We don’t know yet where RailsConf Europe will be in 2009. Probably not Berlin, just because we’d like to move it around. If you have suggestions (and a rationale other than that you happen to live there :-) by all means let me know.&lt;/p&gt;


	&lt;p&gt;Now that &lt;span class="caps"&gt;RCE2008&lt;/span&gt; is over, I’m looking forward to RubyConf. Stay tuned for announcements of the program and registration!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-08-06:175</id>
    <published>2008-08-06T11:57:00Z</published>
    <updated>2008-08-06T11:58:16Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/8/6/pseudo-persuasion-in-online-discourse" rel="alternate" type="text/html" />
    <title>Pseudo-persuasion in online discourse</title>
<content type="html">
            &lt;p&gt;I know it’s pointless&amp;mdash;I’m not going to make a dent in
it&amp;mdash;but I feel moved to say something about the biggest problem
in online discourse: pseudo-persuasion.&lt;/p&gt;


	&lt;p&gt;The term is a bit awkward, but you’ll recognize what I’m talking about
because it monopolizes an almost literally incredible proportion of
email lists, news groups, blog comments, and &lt;span class="caps"&gt;IRC&lt;/span&gt; chats, and you’ve
seen plenty of it. I’m talking about the endless stream of &lt;i&gt;this&lt;/i&gt;
vs. &lt;i&gt;that&lt;/i&gt;. Emacs vs. vi, Ruby vs. Python, Ubuntu vs. Redhat, Mac
vs. PC, tabs vs. spaces, and all the monumentally huge and boring rest
of it.&lt;/p&gt;


	&lt;p&gt;Yes, there are interesting comparative points you can make about all
of these pairings. Yes, some people make interesting points. I’m not
talking about those points. I’m talking about the other 99.99% of
online comparative talk, the inexhaustible store of “mine is better
than yours” drivel, the vacuous chatter that, despite its vacuity,
manages to choke and clog the online world as if it were of substance.&lt;/p&gt;


	&lt;p&gt;I call it pseudo-persuasion because it sounds like persuasive speech,
but isn’t. It is persuasive neither in effect, nor in intent. Millions
upon millions of words pour forth&amp;mdash;arguments in favor of A and
against B, checklists of assertions and accusations, praise of
features and denouncement of shortcomings&amp;mdash;all delivered in the
most fervent persuasive language but not one syllable actually
persuading anyone of anything, and not one syllable written in the
expectation of persuading anyone of anything.&lt;/p&gt;


	&lt;p&gt;Have you ever said to yourself, “Gee, someone on &lt;span class="caps"&gt;IRC&lt;/span&gt; said that
Emacs keybindings aren’t intuitive, so starting tomorrow I’ll switch
to vi”? Have you ever met anyone who, after asking a question about a
Linux problem and receiving an answer consisting of the single
utterance, “OS X!!”, proceeded to run out and buy a Mac? Did
you start using your current favorite programming language because
someone told you, in so many words, that the one you had been using
sucked and this one was better?&lt;/p&gt;


	&lt;p&gt;My late father used to say that “No one ever convinces anyone of
anything.” He didn’t believe it literally, or he would not have bothered
co-authoring the brief in &lt;i&gt;Brown v. Board of Education&lt;/i&gt;.
In general, he didn’t mean it with regard to legal and forensic
argumentation. He did mean it, however, with regard to cocktail party
chatter, exchanges among politically widely-separated colleagues,
heated classroom arguments among students, and the like: day-to-day
exchanges where the urge to state an opinion does not imply an
inclination to take someone else’s opinion seriously.&lt;/p&gt;


	&lt;p&gt;Non-persuasive persuasion can serve a purpose. It’s good, for example,
for students to put their thoughts into words, even though they’re not
really listening to each other. Usually, though, it’s just a way to
fill otherwise awkward social time.&lt;/p&gt;


	&lt;p&gt;When people yap at each other about Emacs and vi, however, it’s not
filling awkward social time. To be honest, I don’t know what it’s
doing. It certainly is not debate. It sounds like debate, and it uses
rhetorical devices that are also found in debate. But it is not
debate. No one can “win”, no one is listening to anyone else, and the
likelihood of persuasion being achieved approaches zero. Nothing is at
stake, and no one actually expects any conclusion, outcome, or
productivity to emerge from the exchange.&lt;/p&gt;


	&lt;p&gt;But my case against pseudo-persuasion is not that the practitioners
don’t take each other seriously enough. They hardly could, given how
much of this crap there is. My case against it is that it’s a 
staggering waste of time, mental energy, and passion. Can you imagine
what would have happened if, over the past couple of decades, 
participants in online forums had taken, say, five percent of the time
they’ve spent pissing at each other, and used it instead to
collaborate on software or technical writings?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-07-20:164</id>
    <published>2008-07-20T12:31:00Z</published>
    <updated>2008-07-20T12:32:39Z</updated>
    <category term="Computers" />
    <category term="Events" />
    <category term="Friends" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/7/20/co-training-with-erik-kastner" rel="alternate" type="text/html" />
    <title>Co-Training with Erik Kastner</title>
<content type="html">
            &lt;p&gt;My friend and nearly-neighbor &lt;a href="metaatem.net"&gt;Erik Kastner&lt;/a&gt; is going to be joining me to teach the Ruby Power and Light course &lt;a href="http://www.rubypal.com/events/08182008"&gt;“Advancing With Rails”&lt;/a&gt; in Edison, New Jersey, August 18-21. This will be &lt;span class="caps"&gt;RPL&lt;/span&gt;’s first co-taught course, and I’m really looking forward to it.&lt;/p&gt;


	&lt;p&gt;See the calendar at &lt;a href="http://www.rubypal.com"&gt;Ruby Power and Light&lt;/a&gt; for more info!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-07-05:150</id>
    <published>2008-07-05T01:27:00Z</published>
    <updated>2008-07-05T01:28:36Z</updated>
    <category term="Computers" />
    <category term="Coolth and Weirdth" />
    <category term="Events" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/7/5/july-6-12-is-link-to-something-other-than-wikipedia-week" rel="alternate" type="text/html" />
    <title>July 6-12 is "Link To Something Other Than Wikipedia" Week!</title>
<content type="html">
            &lt;p&gt;During the week of July 6-12, I invite and encourage everybody who includes links in their email, blog posts, online chats, and other documents, to link to something other than Wikipedia.&lt;/p&gt;


	&lt;p&gt;I’m not trying to be a Wikipedia slayer. It wouldn’t matter if I were; that’s not going to happen.&lt;/p&gt;


	&lt;p&gt;I just want to remind everyone that there are thousands and thousands of interesting, well-informed, thought-provoking, educational websites out there, written by professors, researchers, doctors, artists, scientists, practitioners of every craft and industry&amp;mdash;and however you slice it, these websites are getting a raw deal when it comes to links.&lt;/p&gt;


	&lt;p&gt;It’s not about whether Wikipedia articles are accurate or not. Some are, some aren’t. But that’s true of &amp;lt;emph&gt;the whole Web&amp;lt;/emph&gt;. Let’s stop acting as if Wikipedia has some special status.&lt;/p&gt;


	&lt;p&gt;The best thing about the Web is that it &lt;i&gt;isn’t&lt;/i&gt; an encyclopedia. And Wikipedia is evidence that when Web culture meets encyclopedia culture, encyclopedia culture wins. Sure, Wikipedia is collaborative. Most encyclopedias are. They still give off an aura of total, centralized, complete knowledge and authority. And that’s not very Web-like, is it?&lt;/p&gt;


	&lt;p&gt;So:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;If you’ve got a point to make about grammar, look for an English (or whatever language it is!) professor’s site. There are some great ones. Point the person you’re arguing with to a couple of those.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Countries have their own informational websites, some official and some written by people who live there. Many of them are multi-lingual. Are they “balanced”? Probably not, at least not in the network news way. So much the better! Balance on the Web emerges from the quantity and interplay of sites. It’s not supposed to be embodied in every document. How boring!&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Wikipedia is great for technology-related topics. But so are lots of other sites. Are you &lt;i&gt;sure&lt;/i&gt; that Wikipedia’s description of the algorithm you’re discussing on that mailing list is really the best? the clearest? the most engaging?&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;You get the idea! Strike a blow for the richness of the Web, and for the beauty of discourse that doesn’t try to be poker-faced and non-committal, even about important issues. Rediscover the expertise of the many Web contributors who write about their own specialties and have taken the time to share their thoughts.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;There’s a lot to learn at Wikipedia, but it’s time to spread the linkage!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-06-07:124</id>
    <published>2008-06-07T15:22:00Z</published>
    <updated>2008-06-07T15:24:28Z</updated>
    <category term="Coolth and Weirdth" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/6/7/slide-words-if-that-s-really-what-they-re-called" rel="alternate" type="text/html" />
    <title>Slide words (if that's really what they're called)</title>
<content type="html">
            &lt;p&gt;A guy I was chatting with in the men’s lounge of the spa at Harrah’s
in Atlantic City was telling me about “slide words.” I can’t find
anything about them (and I’ve tried “slider words” and a few other
variants) anywhere. I don’t think he made the term up, and he
certainly didn’t think he had.&lt;/p&gt;


	&lt;p&gt;Anyway, even though I can’t find any background information or
previous discussion, I am going to talk about “slide words” (or
whatever they’re called).&lt;/p&gt;


	&lt;p&gt;A slide word, I gather, is a word or phrase that has come to serve as
shorthand for an entire argument&amp;mdash;except that the argument isn’t really
there. We’re all just supposed to think it is. The slide word acts as a black
hole, drawing further discussion and thoughtful debate into itself and killing
it.&lt;/p&gt;


	&lt;p&gt;Slide words are bad because they take the place of actual analysis of
situations and events. Every slide word has a kind of implicit, “Sigh. Here we
go again” attached to it, even though the “again” part is asserted through the
use of the slide word itself and not actually demonstrated.&lt;/p&gt;


	&lt;p&gt;I have something to say here about three slide words: conspiracy theory,
Chinese menu, and bikeshed.&lt;/p&gt;


&lt;h1&gt;“Conspiracy theory”&lt;/h1&gt;

	&lt;p&gt;“Conspiracy theory” is perhaps the best example of a slide word. Consider the
following exchange, which is made up but is actually very similar to several I
have had:&lt;/p&gt;


&lt;div&gt;
Me: Apparently there might have been an eighth Challenger victim. A
Brazilian fisherman said that his son was struck and killed by falling
debris, while they were out on a boat. 

	&lt;p&gt;Other Person: Why haven’t we heard about it?&lt;/p&gt;


	&lt;p&gt;Me: It was in the news briefly. I guess it was considered more prudent
to downplay it.&lt;/p&gt;


Other Person: That sounds like a conspiracy theory. 
&lt;/div&gt;

	&lt;p&gt;With the invocation of the term “conspiracy theory,” all further
discussion of what might have actually happened is discredited. The events
surrounding the death of John Kipalani’s son need not be examined in
any detail; nor need the press coverage (or lack thereof). “Conspiracy
theory” plays the role of a rebuttal of the statements about the Challenger
disaster, even though it has no actual connection to them.&lt;/p&gt;


Here’s another example:
&lt;div&gt;

	&lt;p&gt;Me: The only people who profited from 9/11 in any way, financially or
politically, were George W. Bush and his family and friends. I
therefore assume, as a matter of the simplest logic, that Bush had
something to do with it.&lt;/p&gt;


Other Person: What are you, a conspiracy theorist? 
&lt;/div&gt;

	&lt;p&gt;Again, the slide word (or slide phrase) gets played as if it were a
trump card, when in fact it has nothing whatsoever to do with the
question of Bush’s culpability in the 9/11 attacks, and neither refutes the
logic that’s on offer nor adds information that might bring about a
reconsideration of that logic.&lt;/p&gt;


&lt;h1&gt;“Chinese menu”&lt;/h1&gt;

	&lt;p&gt;Another slide word I’ve come across, in a somewhat narrower setting, is
“Chinese menu.”&lt;/p&gt;


	&lt;p&gt;When I was teaching at a university, I was involved in lots of discussions,
formal and otherwise, about core curricula: what they should include, how they
should be administered, and so on. I remember that in one series of such
discussions, any time anyone suggested anything along the lines of having
students choose one or more courses from each of several course groupings,
someone else would say, “That’s like a Chinese menu.” Eventually it became
just “Chinese menu.”&lt;/p&gt;


	&lt;p&gt;I have no memory of any discussion of &amp;lt;emph&gt;why&amp;lt;/emph&gt; it was considered a bad
idea to adminster a core curriculum this way. All that was required to rebut
the idea was “Chinese menu.” Actual argumentation did not enter into it.&lt;/p&gt;


&lt;h1&gt;“Bikeshed”&lt;/h1&gt;

	&lt;p&gt;Another slide word, a rather obnoxious one that seems to be enjoying
considerable popularity these days, is “bikeshed.” If someone says “bikeshed,” 
they’ve said all they need to say (or at least all they think they need to
say, and certainly all they’re planning to say) to establish that what you
have been talking about is trivial and not worth discussing.&lt;/p&gt;


	&lt;p&gt;Saying “bikeshed” to someone, instead of telling that person outright that you
find his or her statements trivial and worthless, is not only needlessly indirect but, in
most cases I’ve seen, wrong.&lt;/p&gt;


	&lt;p&gt;The original bikeshed concept, as I understand
it (which is from second-hand accounts, so I could be wrong), had to do with
the phenomenon of committees spending more time arguing over what color to
paint the company bikeshed, than over the allocation of funds to build a
nuclear power plant.&lt;/p&gt;


	&lt;p&gt;The problem with the typical usage of “bikeshed” today is
that there’s no nuclear power plant in the picture. 
It’s more likely to be a bunch of people
on an email list discussing the best name for a proposed new method in Ruby,
or something like that. Then someone who feels superior to the discussion
(which would exclude the creator of Ruby, as well as many of his colleagues,
associates, and friends) comes along and says “Bikeshed.”&lt;/p&gt;


	&lt;p&gt;But if we weren’t
talking about method names, we’d be talking about literal constructors for
runtime objects. And if not that, then perhaps the question of whether
parentheses around parameter lists in method definitions should be mandatory. 
All of these things are important to people interested in the Ruby programming
language; but, with respect, I will state unequivocally that none of them is
as important an issue as nuclear power.&lt;/p&gt;


	&lt;p&gt;Furthermore, saying “bikeshed” implies
that you think the group you’re addressing not only is wasting its time on the
current topic, but has a history of spending too &amp;lt;emph&gt;little&amp;lt;/emph&gt; time on
important things. Even scaling it down so that the important things aren’t
really important things in the nuclear power sense, no one ever says what
those things are. That’s probably because “bikeshed” is just a snide
 way to say, “What you’re saying is stupid,” and not a unit
of cogent or well-sustained argumentation of any kind.&lt;/p&gt;


	&lt;p&gt;Thus slide words. I’m glad there’s a name for them, even though it’s puzzling
that the only person who seems to have heard the name is that guy at Harrah’s.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-05-04:99</id>
    <published>2008-05-04T13:59:00Z</published>
    <updated>2008-05-04T14:00:14Z</updated>
    <category term="Events" />
    <link href="http://dablog.rubypal.com/2008/5/4/death-of-a-racehorse" rel="alternate" type="text/html" />
    <title>Death of a racehorse</title>
<content type="html">
            &lt;p&gt;I’ve always vaguely disliked horse races. The anthropomorphizing of the horses, the claims that they know that they’re involved in a race and that they share the goals of their owners, is manifestly silly and self-serving. And the whipping always bothered me. I suppose I made myself believe that horses didn’t really care and that an attack with a whip was, to them, kind of like a verbal exhortation to us. (Not that verbal exhortations can’t be painful, but they’re not physical).&lt;/p&gt;


	&lt;p&gt;The death of Eight Belles shocked me out of my indifferent, complacent position.&lt;/p&gt;


	&lt;p&gt;All the crap in the news about how noble she was, how competitive her spirit, how great her self-sacrifice… it’s all smug and disgusting beyond belief, despite the accompanying descriptions of the tears glistening in the eyes of the various stakeholders. What really happened was that this horse was forced to run as fast as she could, for reasons she could not understand and that had nothing to do with her well-being, and as a direct result, her legs fell apart, and then someone killed her.&lt;/p&gt;


	&lt;p&gt;That’s it; that’s all there is to it.&lt;/p&gt;


	&lt;p&gt;Why is this allowed to go on? Is it simply because more horses survive races than don’t?&lt;/p&gt;


	&lt;p&gt;For some reason, we continue to give the benefit of the doubt to this bizarre, nasty, money-drenched “sport”. Except that for me, at this point, there is no doubt, and no further conferral of the benefit.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-04-24:97</id>
    <published>2008-04-24T11:55:00Z</published>
    <updated>2008-04-24T11:58:08Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/4/24/splitting-hairs-over-resource-part-2" rel="alternate" type="text/html" />
    <title>Splitting hairs over "resource": the case for the affirmative (Part 2)</title>
<content type="html">
            &lt;p&gt;In &lt;a href="http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource"&gt;part 1&lt;/a&gt; of this two-part post, I explained my concern that the word
“resource” has become too closely associated in Rails-related usage
with some combination of model, database table, and controller/model
stack&amp;mdash;none of which do justice, as definitions or even first
approximations, to the concept of a &lt;span class="caps"&gt;REST&lt;/span&gt; resource as originally
described by Roy Fielding. Here, I’m going to expand on this
observation by exploring a few ramifications of the same topic.&lt;/p&gt;


&lt;h2&gt;Resources, controllers, and models (or lack thereof)&lt;/h2&gt;

	&lt;p&gt;As I explained in the previous post, the concept of “resource” has no
database implications&amp;mdash;indeed, no implementation implications.
A resource does not have to have a corresponding model. It also does
not have to have a corresponding controller. Resources are far more
high-level than controllers and models. Controllers and models are
tools with which you provide access to representations of resources.&lt;/p&gt;


	&lt;p&gt;However, if you want to draw a line between resources and Rails, by
far the better line to draw is the one that points to controllers
rather than models. A controller is not a resource, but it comes
closer than anything else in your application to taking on the
features of your resources. Models are another big step away.&lt;/p&gt;


	&lt;p&gt;If controllers are closest to resources, how does this play out? One
way is in the creation of resources for which requests are handled by
a controller that has no corresponding model.&lt;/p&gt;


	&lt;p&gt;My favorite example of a likely modelless resource is the shopping
cart.  In &lt;i&gt;Ruby for Rails&lt;/i&gt;, I use a shopping cart in my central
example.  When I started working on this application, I tried to model
it directly; I imagined I would have a ShoppingCart class, a
shopping_carts table, and so forth.&lt;/p&gt;


	&lt;p&gt;I quickly realized, however, that I didn’t need that. What I was
calling a “shopping cart” was really a virtual construct or, in Rails
terms, a view. I had Order objects and Customer objects, and the shopping
cart was basically a screen showing all of a particular customer’s
open orders. Calling it a “shopping cart” was just a kind of semantic
sugar. There was no need to persist it separately from the persistence
of the orders and the customer.&lt;/p&gt;


	&lt;p&gt;If I were writing the same application today using RESTful idioms, I
would in all likelihood do:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;map.resources :customers do |c|
  c.resource :shopping_cart
end&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;or words to that effect. I would then have a shopping_carts
controller, with a show action (probably leaving all the related &lt;span class="caps"&gt;CRUD&lt;/span&gt;
stuff back in the orders controller, though there might be several
ways to approach that part of it). And I would, without hesitation, describe
the
shopping cart as a resource&amp;mdash;even though it has no ShoppingCart
model behind it. From
the perspective of the consumers of my resources, it doesn’t matter
whether there’s a ShoppingCart model (and shopping_carts database
table) or not. I can decide on the best application design, and use
RESTful Rails techniques to support my design decisions appropriately.&lt;/p&gt;


	&lt;p&gt;A resource is not a model, and it’s also not a controller. Identifying
the resource with the controller is, however, somewhat closer to the
mark. The controller layer conforms most closely to the resource
mapping, which makes sense since the controller is the port of call
when someone connects to your application.&lt;/p&gt;


	&lt;p&gt;Another area where misunderstandings arise in the course of designing RESTful services in Rails
is in the matter of how identifiers (URI) map to resources&amp;mdash;and not just how, but
how many.&lt;/p&gt;


&lt;h2&gt;Identifiers and resources: not always one-to-one&lt;/h2&gt;

	&lt;p&gt;I’ve seen people tie themselves in knots trying to come up with the
best way to label and/or nest resources. One of the principles that’s
gotten lost in the mix is that the ratio between resources and
identifiers does not have to be one-to-one. Fielding states:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;[A] resource can have many identifiers. In other words, there may exist
two or more different &lt;span class="caps"&gt;URI&lt;/span&gt; that have equivalent semantics when used to
access a server. It is also possible to have two &lt;span class="caps"&gt;URI&lt;/span&gt; that result in
the same mechanism being used upon access to the server, and yet those
&lt;span class="caps"&gt;URI&lt;/span&gt; identify two different resources because they don’t mean the same
thing.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Therefore, it’s possible that this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;http://dabsite.com&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;http://dabsite.com/welcome&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;can identify the same resource, which would probably be described as
something like “The welcome and orientation information at
dabsite.com”.  The reason they’re the same resource is not that they
generate the same &lt;span class="caps"&gt;HTML&lt;/span&gt;.  Rather, they’re the same resource because
they’re published as the same resource.&lt;/p&gt;


	&lt;p&gt;It’s also possible that this: &lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;http://dabsite.com/orders/211   # 211th order in the system&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and this: &lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;http://dabsite.com/orders/042208-003  # third order placed on 4/22/08&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;identify different resources, even if the third order placed on
4/22/08 happens to be the 211th order in the system. That’s because
resources are not database rows. In this case, the two requests might
generate the same &lt;span class="caps"&gt;HTML&lt;/span&gt;, but still pertain to different resources.&lt;/p&gt;


	&lt;p&gt;You don’t have to make a point of having a non-one-to-one ratio
between your resources and your identifiers. Just be aware that if
such a ratio emerges, in either direction, you’re not doing anything
inherently “unRESTful.”&lt;/p&gt;


&lt;h2&gt;&lt;span class="caps"&gt;CRUD&lt;/span&gt; and &lt;span class="caps"&gt;REST&lt;/span&gt; and resources&lt;/h2&gt;

	&lt;p&gt;One of the nice things about the &lt;span class="caps"&gt;REST&lt;/span&gt; support in Rails is that it 
dovetails with &lt;span class="caps"&gt;CRUD&lt;/span&gt;-based thinking about modeling. I add in haste: 
&lt;span class="caps"&gt;REST&lt;/span&gt; is not &lt;span class="caps"&gt;CRUD&lt;/span&gt;, and &lt;span class="caps"&gt;CRUD&lt;/span&gt; is not &lt;span class="caps"&gt;REST&lt;/span&gt;. (That’s no secret, but I want
to go on record with it.) But in Rails, there’s a nice relationship
between them.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;REST&lt;/span&gt; support in Rails emphasizes the convention of &lt;span class="caps"&gt;CRUD&lt;/span&gt;
operations. map.resources gives you a fistful of named routes that
have built-in knowledge of &lt;span class="caps"&gt;CRUD&lt;/span&gt; action names. The emphasis on &lt;span class="caps"&gt;CRUD&lt;/span&gt; at
this level encourages you to think of modeling for &lt;span class="caps"&gt;CRUD&lt;/span&gt;. Instead of
having, say, a users controller with a borrow_book action, you can
have a loans controller with a create action. In many cases, this
way of thinking might also wag the dog of your domain modeling. Thinking
about &lt;span class="caps"&gt;CRUD&lt;/span&gt; in the controller might, for example, lead you to conclude that
you should have a Loan model.&lt;/p&gt;


	&lt;p&gt;It’s perfectly fine&amp;mdash;indeed, in my view, it’s very productive&amp;mdash;to
think along these lines, to bring your modeling and your &lt;span class="caps"&gt;REST&lt;/span&gt;-friendly
&lt;span class="caps"&gt;CRUD&lt;/span&gt; operations into harmony, as long as you understand that none of this
is actually about resources as such. Rather, it’s about the Rails
flavor of implementing the handlers that underpin the creation of
resource representations.&lt;/p&gt;


	&lt;p&gt;Does that sound like just a lot of extra words? It isn’t. It’s a lot
of words, but they’re not extra. Again, it’s important not to squeeze
the entire framework into the “resource” label. Let a resource be a
resource, and let the handler layers be handler layers. They’re nicely
engineered&amp;mdash;but they’re not resources.&lt;/p&gt;


	&lt;p&gt;And then there’s the word “representation,” which crept into my “extra words” 
sentence but which is the least extra of all of them.&lt;/p&gt;


&lt;h2&gt;Representations: the one that got away&lt;/h2&gt;

	&lt;p&gt;The representation is, in my view, the one that got away: the central
concept in &lt;span class="caps"&gt;REST&lt;/span&gt; that no one in the Rails world ever seems to talk
about. We need to, though. It’s vitally important.&lt;/p&gt;


	&lt;p&gt;Your server does not traffic in resources. It traffics in
representations of resources. Users of your application do not receive
resources. They receive representations. The distinction is big; at
stake is the entire meaning, and meaningfulness, of the notion of a
resource.&lt;/p&gt;


	&lt;p&gt;We need the concept of “representation” because it’s the part of &lt;span class="caps"&gt;REST&lt;/span&gt;
theory that relieves the pressure on the term “resource.” After all, how can a resource be a
“conceptual mapping” (Fielding) &lt;i&gt;and&lt;/i&gt; a sequence of bytes that a server sends
you &lt;i&gt;and&lt;/i&gt; a controller-model stack…? It can’t, and it’s only
the first of these things. The second, the response itself, delivers a
representation of a resource.&lt;/p&gt;


	&lt;p&gt;One resource can have many representations. There’s no big news here;
we all know that a server can give us a text version of &lt;i&gt;Jane Eyre&lt;/i&gt; or
a movie version or an audio version. (I’ll refrain from getting philosophical
about whether or not a book and a movie are “the same” in any deep sense.
They’re the same enough, in this context.) The point is that we don’t need to
mush everything into the term “resource.” Rather, we benefit by
yanking that term up to the high level where it belongs, and applying
the term “representation” to the actual response we’re getting.&lt;/p&gt;


	&lt;p&gt;Fielding has much more on representations in his dissertation, and I’m
not going to try to paraphrase it here. My point is to encourage the
liberal use of the term in Rails discourse about &lt;span class="caps"&gt;REST&lt;/span&gt;. The poor term
“resource” has already been given too much to do. We need to delegate
some of the domain description to the other terms that apply to it.&lt;/p&gt;


&lt;h2&gt;Now what?&lt;/h2&gt;

	&lt;p&gt;The use of the term “resource” to mean things that, I’ve argued here, it
really doesn’t mean is rather deeply entrenched, and widespread, in Rails
discourse. I don’t have any quick fix for this. I do have a few recommendations, though.&lt;/p&gt;


	&lt;p&gt;First, read
&lt;a href="http://www.ics.uci.edu/~fielding/pubs/dissertation"&gt;Roy Fielding’s dissertation&lt;/a&gt;. You can skip to chapters 5 and 6 and get a great
deal out of them.&lt;/p&gt;


	&lt;p&gt;Second, pay particular attention to the concept of the representation. I don’t think we
can get much further in exploring &lt;span class="caps"&gt;REST&lt;/span&gt; and Rails unless the representation makes a
comeback. “Resource” is just plain spread too thin in the way it’s used in and around
Rails, and there’s no reason why it has to be, if we look at the theory as a whole.&lt;/p&gt;


	&lt;p&gt;Third, and last, don’t assume that any deviation from the out-of-the-box behaviors
in your RESTful Rails applications is unRESTful. The defaults are in place because
they’re high percentage. But they’re just as opinionated as the rest of Rails, and in
some respects more so. That’s OK, but do understand that they’re &lt;span class="caps"&gt;REST&lt;/span&gt;-friendly tools. 
They’re not a definitive statement on the entirety of what &lt;span class="caps"&gt;REST&lt;/span&gt; is.&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;REST&lt;/span&gt; is not an easy topic, and it’s unlikely that anyone is
going to create a way for you to create and maintain RESTful applications, over time,
without you trying to get a handle on it and developing your own understanding of
resources, representations, requests, and responses. I hope these posts will help you out in that endeavor.&lt;/p&gt;


&lt;h2&gt;References&lt;/h2&gt;

	&lt;p&gt;Fielding, Roy Thomas. &lt;a href="http://www.ics.uci.edu/~fielding/pubs/dissertation"&gt;Architectural Styles and the Design of
Network-based Software Architectures.&lt;/a&gt;. Doctoral dissertation,
University of California, Irvine, 2000.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-03-28:91</id>
    <published>2008-03-28T09:40:00Z</published>
    <updated>2008-03-28T10:32:09Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/3/28/getting-out-of-ruby-s-way-code-beauty-and-or-greatness" rel="alternate" type="text/html" />
    <title>Getting out of Ruby's way: code beauty and/or greatness</title>
<content type="html">
            &lt;p&gt;&lt;a href="http://www.chadfowler.com"&gt;Chad Fowler&lt;/a&gt; wrote an interesting article this week on the subject of &lt;a href="http://www.chadfowler.com/2008/3/27/great-ruby-code"&gt;Great Ruby Code&lt;/a&gt;. The article concludes with an invitation for comment:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Anyway, I still don’t have a satisfactory list of great Ruby code. I’d like to build such a list. So, please leave a comment saying the name of an open source Ruby project you feel represents truly great Ruby code.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;My comments are somewhat “meta”, and I had an interesting chat with Chad about the whole topic of greatness in Ruby code after I’d read the article, so I thought I’d make my comments here in an article of my own.&lt;/p&gt;


	&lt;p&gt;For me, the very concept of great Ruby code contains the seeds of its own destruction. Here’s why.&lt;/p&gt;


	&lt;p&gt;When I see Ruby code and think, “This is great,” what I usually mean, at least as a first approximation, is that &lt;i&gt;Ruby&lt;/i&gt; is great. I don’t mean that everything written in Ruby is automatically great. But I do find that a lot of what’s involved in writing what I consider beautiful Ruby code is getting out of Ruby’s way. Ruby is famous for getting out of &lt;i&gt;your&lt;/i&gt; way; but you can and should return the favor.&lt;/p&gt;


	&lt;p&gt;I’m slipping between “great” and “beautiful,” which isn’t fair but maybe that’s part of the problem: I’m not sure what pure greatness in Ruby code would be, because I tend to perceive Ruby code in terms of beauty&amp;mdash;not down to the millihelen,[1] perhaps, but as an overall matter&amp;mdash;rather than greatness; and I can’t really give an individual programmer “credit,” so to speak, for the beauty I find in, say, &lt;code&gt;yield&lt;/code&gt; or &lt;code&gt;class &amp;lt;&amp;lt; object&lt;/code&gt; or the technically unnecessary but, in my view, manifestly elegant class/module distinction.&lt;/p&gt;


	&lt;p&gt;Then there’s the subjectivity issue (as many of you non-fans of &lt;code&gt;class &amp;lt;&amp;lt; object&lt;/code&gt; are probably thinking right about now!). Of course Chad isn’t anticipating universal agreement on what’s great in Ruby code. But for me, the impossibility of consensus is another seed of the very concept’s own destruction. It’s an irony, even a paradox: if there &lt;i&gt;is&lt;/i&gt; such a thing as greatness in Ruby code, we’ll never find it because once we shift the discussion to the plane of “What do you consider great?”, it’s likely to unravel in the same way that discussions about what’s great in any art unravel.&lt;/p&gt;


	&lt;p&gt;And about that art thing: Coding is of course an art, but it’s a peculiar one in that the artist is operating within the boundaries set by another artist&amp;mash;namely, the designer of the language. (Note that I said coding, not programming. I’m not trying to drive a wedge between them, but as Knuth and others have shown us, there are aspects to the art of computer programming that are not about this or that language, and I’d like to keep the terminology at least a bit separate.) Is it like music? Are we interpreting Matz’s score? Or is Matz the playwright, we the actors? Or perhaps Matz is like whoever invented baseball: a set of rules within which we elect to operate. Well, there are great baseball players….&lt;/p&gt;


	&lt;p&gt;Maybe greatness in Ruby is ours to lose: If you follow stylistic best practices (which is another, but in my view related, matter), and above all &lt;i&gt;let the language talk to you&lt;/i&gt; and don’t “write {Java,C,Perl,...} in Ruby,” your code will be great, or beautiful if you prefer, because you’ve collaborated successfully with Ruby. And yes, I do think that Ruby confers an advantage here over many other languages. For me, the most important key to Ruby’s beauty and its greatness is that Ruby code gets &lt;i&gt;clearer&lt;/i&gt;, rather than more cryptic, as it gets shorter. I don’t want to jump through the hoop of reciting all the obvious facts (that this can be true in other languages; that Ruby code &lt;i&gt;can&lt;/i&gt; be cryptic; etc.). I present it for what it is: my take on the magic of Ruby. I’ve always said that as you work on a Ruby program, code disappears from your screen. So it does&amp;mdash;and the program becomes more, rather than less, expressive and communicative.&lt;/p&gt;


	&lt;p&gt;There’s no tidy stopping point to this exploration, and that’s as it should be. I encourage you to go to Chad’s article and read it and respond. I don’t expect us to end up with a definitive list of great Ruby code. But what Chad is doing is inviting us to look&amp;mdash;&lt;i&gt;really&lt;/i&gt; look&amp;mdash;and I find it well worth the trouble.&lt;/p&gt;


	&lt;p&gt;[1] A millihelen is the amount of beauty required to launch one ship. (I wish I could take credit for that one but I only know it as an old joke.)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-03-26:85</id>
    <published>2008-03-26T13:46:00Z</published>
    <updated>2008-03-27T16:48:08Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/3/26/short-circuit-post-correction" rel="alternate" type="text/html" />
    <title>Short-circuit (||=) post -- CORRECTION</title>
<content type="html">
            &lt;p&gt;There was &lt;a href="http://procnew.com/ruby-short-circuit-edge-case-response.html"&gt;a response to my post from yesterday&lt;/a&gt; on Procnew.com, which pointed out that when you’ve got this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;x ||= y&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;it doesn’t expand to this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;x or x = y&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;(which is what I said in my last post) but rather to this:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;x || x = y&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;I believe that’s right. It’s kind of hidden until you do:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;a = x ||= y&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and you start to see that it behaves like the || expansion, not the or expansion.&lt;/p&gt;


	&lt;p&gt;The example on Procnew.com has one glitch, which is that on line 9 of the irb session, it’s using a value that’s already set (h[:y]), so it’s never going to jump over the || anyway. Still, I believe the point is right.&lt;/p&gt;


	&lt;p&gt;Pending other edge-case edge-cases, anyway…. :-)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-03-25:83</id>
    <published>2008-03-25T15:11:00Z</published>
    <updated>2008-03-28T08:52:10Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/3/25/a-short-circuit-edge-case" rel="alternate" type="text/html" />
    <title>A short-circuit (||=) edge case</title>
<content type="html">
            &lt;p&gt;In Ruby, you can conditionally set a variable like this:&lt;/p&gt;


&lt;pre&gt;
  x ||= 1
&lt;/pre&gt;

	&lt;p&gt;If x is not initialized&amp;mdash;or if it is set to &lt;code&gt;nil&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;&amp;mdash;it will be assigned 1. If it’s already set to a Booleanly true value (i.e., anything other than &lt;code&gt;nil&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;), it will remain unchanged.&lt;/p&gt;


	&lt;p&gt;Most descriptions of this idiom, including mine, have said that it expands to this:&lt;/p&gt;


&lt;pre&gt;
  x = x || 1
&lt;/pre&gt;

	&lt;p&gt;Last year, though, an edge case came to light on the ruby-talk mailing list. It involves hashes with default values.&lt;/p&gt;


&lt;h2&gt;Trouble in &lt;code&gt;||=&lt;/code&gt;-land&lt;/h2&gt;

	&lt;p&gt;Here’s an irb session illustrating the case. First, we’ll create a hash with a default value of 1.&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h = Hash.new(1)
  =&amp;gt; {}
&lt;/pre&gt;

	&lt;p&gt;Remember that the default value is what the hash returns for non-existent keys. There are no assignment implications; referring to a non-existent key does not result in setting that key in the hash.&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h[:x]
  =&amp;gt; 1
  &amp;gt;&amp;gt; h
  =&amp;gt; {}        # still empty!
&lt;/pre&gt;

	&lt;p&gt;Now let’s try the &lt;code&gt;||=&lt;/code&gt; idiom.&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h[:x] ||= 2
  =&amp;gt; 1
&lt;/pre&gt;

	&lt;p&gt;Once again, no assignment has taken place:&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h
  =&amp;gt; {}
&lt;/pre&gt;

	&lt;p&gt;This struck a number of us on the mailing list as weird. It certainly means that &lt;code&gt;||=&lt;/code&gt; does not expand the way we had assumed it did. Here’s the proof: try the expanded version, and you’ll see that it &lt;i&gt;does&lt;/i&gt; assign to the hash, as you’d expect.&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h[:x] = h[:x] || 2
  =&amp;gt; 1
  &amp;gt;&amp;gt; h
  =&amp;gt; {:x=&amp;gt;1}
&lt;/pre&gt;

	&lt;p&gt;So there we have proof that &lt;code&gt;x ||= y&lt;/code&gt; and &lt;code&gt;x = x || y&lt;/code&gt; are not interchangeable.&lt;/p&gt;


	&lt;p&gt;That raises two questions: first, what &lt;i&gt;does&lt;/i&gt; &lt;code&gt;x ||= y&lt;/code&gt; expand to, and second, do we like it?&lt;/p&gt;


&lt;h2&gt;The true expansion of &lt;code&gt;||=&lt;/code&gt;&lt;/h2&gt;

	&lt;p&gt;At RubyConf 2007, I was running a “Ruby Clinic”, where people could come and go and ask questions about Ruby. Matz stopped by for a while, and the &lt;code&gt;||=&lt;/code&gt; topic came up. He explained that the real expansion is:&lt;/p&gt;


&lt;pre&gt;
  x or x = y
&lt;/pre&gt;

	&lt;p&gt;&lt;b&gt;Note (a day later): It’s been pointed out to me that expansion
as x || x = y is more accurate. I believe that’s right, though my examples
here didn’t flush it out.&lt;/b&gt;&lt;/p&gt;


	&lt;p&gt;Sure enough, expanding it this way produces parallel results in the hash case. Continuing the same irb session:&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h
  =&amp;gt; {:x=&amp;gt;1}
  &amp;gt;&amp;gt; h[:y] ||= 3
  =&amp;gt; 1
&lt;/pre&gt;

	&lt;p&gt;After that conditional assignment, the hash has not changed.&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h
  =&amp;gt; {:x=&amp;gt;1}
&lt;/pre&gt;

	&lt;p&gt;And expanding it in the “or” style also does not change the hash:&lt;/p&gt;


	&lt;p&gt;&lt;b&gt;See “Note”, above.&lt;/b&gt;&lt;/p&gt;


&lt;pre&gt;
  &amp;gt;&amp;gt; h[:y] or h[:y] = 3
  =&amp;gt; 1
  &amp;gt;&amp;gt; h
  =&amp;gt; {:x=&amp;gt;1}
&lt;/pre&gt;

	&lt;p&gt;That clears that up. But do we like the way this plays out with hash defaults?&lt;/p&gt;


&lt;h2&gt;Editorial comments&lt;/h2&gt;

	&lt;p&gt;I have mixed feelings about it. I can see that it makes sense. On the other hand, I can’t help thinking that when you write this:&lt;/p&gt;


&lt;pre&gt;
  hash[:x] ||= 2
&lt;/pre&gt;

	&lt;p&gt;you’re really expecting the hash to end up with an &lt;code&gt;:x&lt;/code&gt; key. In other words, my gut feeling is that it should mean:&lt;/p&gt;


&lt;pre&gt;
  hash[:x] = 2 unless hash.has_key?(:x)
&lt;/pre&gt;

	&lt;p&gt;However, I understand that having it mean that would involve special-casing the hash case, and in the long run, I’m not in favor of that.&lt;/p&gt;


	&lt;p&gt;So what it comes down to is: heads up a bit with &lt;code&gt;||=&lt;/code&gt;. It works fine, but you need to know the real expansion.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-03-23:82</id>
    <published>2008-03-23T00:49:00Z</published>
    <updated>2008-03-26T15:35:15Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource" rel="alternate" type="text/html" />
    <title>Splitting hairs over "resource": the case for the affirmative (Part 1)</title>
<content type="html">
            &lt;p&gt;I’ve commented on the main Rails mailing list and elsewhere about some
concerns I have about the way the term “resource” has been
adopted into Rails practice and discussions. I’d like to explain those
concerns in a little more detail.&lt;/p&gt;


	&lt;p&gt;In this post, I’ll talk about the definition of a resource and why
it’s a good idea not to overpaint the original definition with a
redefinition based on the specifics of Rails. In the next, follow-up
post, I’ll comment on several closely related issues, including the
usefulness of model-less resources, why it’s better (though not
perfect) to identify a controller with a resource than to identify a
model with a resource, the relation between &lt;span class="caps"&gt;CRUD&lt;/span&gt; and resources, and
the role of the “representation”—an important and concept often
overlooked in discussions of &lt;span class="caps"&gt;REST&lt;/span&gt; in Rails.&lt;/p&gt;


&lt;h2&gt;Controller + model: what a resource isn’t&lt;/h2&gt;

	&lt;p&gt;The problem, in a nutshell, is that the term “resource” has come to be
understood widely as meaning “ActiveRecord model” or, perhaps more
commonly, “controller-model stack.” People say that they’ve “created
an item resource” when what they mean is that they’ve generated a
item model and an items controller. There’s no reason for there not to
be a short, concise term for “name-matched controller-model stack.” 
But that word should not be “resource.”&lt;/p&gt;


	&lt;p&gt;Equating “resource” with controller-model stack has the unfortunate
effect of leaving us without a term to refer to what Roy Fielding
originally meant by “resource”—which is definitely not
“controller-model stack” or anything like it. (More on what a resource
&lt;i&gt;is&lt;/i&gt; presently.) Fielding’s description of a resource is deeply
interesting, and worth protecting from terminological drift. Moreover,
there’s no loss involved. In fact, by teasing apart the threads of
what’s a resource and what isn’t, we can actually get more out of the
RESTful tools available in Rails.&lt;/p&gt;


	&lt;p&gt;Defining “resource” as controller + model severely
limits imaginative thought about how a resource, in the original
sense, might play out in Rails. By imaginative, I do not mean
improvisatory or chaotic. The Rails &lt;span class="caps"&gt;REST&lt;/span&gt; conventions are very powerful
and tremendously useful, and I’m fine with being conservative about
deviating from them ad hoc. But I wince when I see people agonizing
because they’ve manipulated Model A in Controller B, and think that
they’ve violated RESTful principles because they’re crossing
resource lines.  That’s not how it works; that’s not how the concept
of resource maps to Rails technology.&lt;/p&gt;


	&lt;p&gt;Obviously Rails uses controllers and models, so whatever a resource 
is, somewhere along the line it’s likely to involve those things in a
Rails application. The wrong turn, though, is in assuming that a
resource &lt;i&gt;is&lt;/i&gt; a controller and/or model.&lt;/p&gt;


	&lt;p&gt;I tend to think that much of this way of viewing the matter comes from the so-called resource scaffolding. It’s easy to
understand why Rails developers, presented with a tool that generates
a controller-model chain and calls it a “resource,” would either not
see the need to question the terminology, or would be reluctant to do
so. But there is a need to question it. The term “resource,” as used
very commonly in Rails discussions, bears much more resemblance to how
it’s used in the context of Rails scaffolding than how it’s used by
Fielding. That doesn’t benefit anyone.&lt;/p&gt;


	&lt;p&gt;Scaffolding or not, something has led people to think that a resource
consists of a controller and a matching model. It doesn’t.&lt;/p&gt;


&lt;h2&gt;What a resource is&lt;/h2&gt;

	&lt;p&gt;Rails is database-intensive, so the temptation exists to conclude that
the word “resource” has something to do with database tables and
persistence. Fielding could hardly state the case against this
perspective more strongly:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;The resource is not the storage object. The resource is not a
mechanism that the server uses to handle the storage object.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Already one has to wonder how the generation of an ActiveRecord
model and migration ever came to be viewed as part of creating a
resource &lt;i&gt;per se&lt;/i&gt; (as it is in the scaffolding). Anyway—Fielding goes on
to define what a resource &lt;i&gt;is&lt;/i&gt;:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;The resource is a conceptual mapping — the server receives the
identifier (which identifies the mapping) and applies it to its
current mapping implementation (usually a combination of
collection-specific deep tree traversal and/or hash tables) to find
the currently responsible handler implementation and the handler
implementation then selects the appropriate action+response based on
the request content.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;This sentence is a bit more complex than the first two, and it’s worth
breaking it down for the sake of seeing how it might map to Rails.&lt;/p&gt;


	&lt;p&gt;The key idea is that a resource is a &lt;i&gt;conceptual&lt;/i&gt; mapping. You send a
resource identifier to a server. The server sends back a response (a
“representation” of the resource, as we learn elsewhere). In between,
the server does what it has to in order to generate the response.&lt;/p&gt;


	&lt;p&gt;The response is a representation, not a resource. And the mechanisms
by which the representation is generated are not, themselves, the
resource. In Rails, those mechanisms typically include the routing
system (which I would roughly identify with what Fielding calls “the
current mapping implementation”) and the controller objects with their
actions (the “responsible handler implementation”). Again, these
mechanisms are not the resource.  And the model layer, which lies yet
further away in the architecture, is &lt;i&gt;really&lt;/i&gt; not the resource.&lt;/p&gt;


	&lt;p&gt;The benefit of splitting hairs over the terminology is that it points the way
to recovering Fielding’s original concept of a resource, of which I don’t get
very many glimpses in the typical discussion of RESTful support in Rails. To the
extent that you are setting up models and controllers and RESTful routing,
you are putting in place the wiring that will allow your system to fulfill its
contract as a provider of representations of certain resources. To the extent
that you are determining what resources your system is responsible for, you’re
performing a task that has no dependency on Rails or any other specific
software tools.&lt;/p&gt;


&lt;h2&gt;The robustness of resources&lt;/h2&gt;

	&lt;p&gt;Part of the problem with using “resource” to refer directly to parts
of the Rails application itself is that it introduces a fragility into
the concept of resource, and the identity of specific resources, that
really shouldn’t be there. If you declare that your system is
responsible for the Resource N, then it shouldn’t matter how many
controllers, actions, models, and database tables you use. I don’t
mean that it doesn’t matter in terms of software design. I mean that
Resource N should be above the fray. It should be robust enough not to
depend &lt;i&gt;for its identity as a resource&lt;/i&gt; on the specifics of the
way you handle the mapping of identifiers to representations.&lt;/p&gt;


	&lt;p&gt;It’s instructive in this context to consider how the concept of
“resource” plays out when you’re serving a static &lt;span class="caps"&gt;HTML&lt;/span&gt; page. The way
it plays out is the same as the way it plays out when you’re
generating a dynamic response. In other words, whether or not
something is a resource has nothing to do with the question of
whether or not its representations are generated dynamically, nor with
the question of whether a database has been queried or a template
rendered in the process of the production of a representation.&lt;/p&gt;


	&lt;p&gt;This is just terminological common sense. Imagine if you were 
publishing information about resources available through your system,
and you had to explain that sometimes they weren’t really “resources” 
because they didn’t hit a Rails controller and database table. That
would be ludicrous. Obviously a resource is a resource, not because of
how its representation is generated behind the scenes but because a
representation is returned, however it’s generated, based on a mapping
of identifiers to request handlers.&lt;/p&gt;


	&lt;p&gt;So if you start thinking of controllers and models as actually being
resources, you’ve painted yourself into a corner where you have no
term that describes a resource in a higher-level sense—no way to
identify the “conceptual mapping” that Fielding stipulates. 
Controllers and models are part of the handling and response
mechanism. They are not resources.&lt;/p&gt;


	&lt;p&gt;But once you decouple the notion of resource from the specifics of how
Rails applications generate representations of resources, a lot of
other things fall into place. In the second half of this essay, I’ll
be looking at several &lt;span class="caps"&gt;REST&lt;/span&gt;-related topics that I think benefit
directly from the liberating and sense-making effect of observing the
distinctions among resource, representation, and handler mechanisms.&lt;/p&gt;


&lt;h2&gt;References&lt;/h2&gt;
&lt;p&gt;Fielding, Roy Thomas. &lt;i&gt;
&lt;a href="http://www.ics.uci.edu/~fielding/pubs/dissertation"&gt;Architectural Styles and the Design of
Network-based Software Architectures&lt;/a&gt;&lt;/i&gt;. Doctoral dissertation,
University of California, Irvine, 2000&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2008-03-22:81</id>
    <published>2008-03-22T19:17:00Z</published>
    <updated>2008-03-28T08:52:50Z</updated>
    <category term="Computers" />
    <category term="Ruby" />
    <link href="http://dablog.rubypal.com/2008/3/22/upcoming-rails-training-2008" rel="alternate" type="text/html" />
    <title>Upcoming Rails training, 2008!</title>
<content type="html">
            &lt;p&gt;Long time, no blog. But now I'm out of hibernation. &lt;/p&gt;

&lt;p&gt;I've got some Rails training courses coming up, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Advancing with Rails, April 14-17, New York City&lt;/li&gt;
&lt;li&gt;Intro to Rails, June 9-12, Berlin, Germany&lt;/li&gt;
&lt;li&gt;Advancing with Rails, June 16-19, Berlin, Germany&lt;/li&gt;
&lt;li&gt;Intro to Rails, June 24-27, London (at Skills Matter)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See &lt;a href="http://www.rubypal.com"&gt;Ruby Power and Light&lt;/a&gt; for details. &lt;/p&gt;

&lt;p&gt;The Berlin courses are being taught in English. The info about them on the Web might only be
in German... but you can always &lt;a href="mailto:dblack@rubypal.com"&gt;contact me&lt;/a&gt; for more
info if you're interested. Berlin is a very cool place -- I highly recommend it!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://dablog.rubypal.com/">
    <author>
      <name>dblack</name>
    </author>
    <id>tag:dablog.rubypal.com,2007-10-19:79</id>
    <published>2007-10-19T12:13:00Z</published>
    <updated>2007-10-19T12:13:20Z</updated>
    <link href="http://dablog.rubypal.com/2007/10/19/advancing-with-rails-training-in-berlin-nov-19-22" rel="alternate" type="text/html" />
    <title>"Advancing with Rails" training in Berlin, Nov. 19-22</title>
<content type="html">
            &lt;p&gt;I suspect it won’t appeal to the Thanksgiving-inclined, but I’ll be teaching my “Advancing With Rails” course, for intermediate Rails developers, in Berlin, Germany, November 19-22.&lt;/p&gt;


	&lt;p&gt;Advancing With Rails is designed for people who have done some Rails… read a couple of books… and want to keep going and get better at it. I’ll be covering Ruby language topics as well as Rails techniques and best practices.&lt;/p&gt;


	&lt;p&gt;The course will be conducted in English, though I speak German and can field questions in either language.&lt;/p&gt;


	&lt;p&gt;More info &lt;a href="http://www.railsschulung.de/"&gt;here&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
</feed>
