Archive for the ‘Ruby’ Category

3
Jan

Learning to pair program

   Posted by: rew   in Programming, Ruby, Tech

Update (2009-01-16): You can read about my first tour stop here. I’m fired up now, so I’m looking far and wide for more folks with which to do this.

I’d like to do some pair programming. The problem is, you can’t exactly do that by yourself. At least, not if you’re reasonably healthy of mind, as I understand it.

I’m looking for someone willing to let me come to your place and “pair up” with you for at least a day. I can’t promise how useful I’ll be, but I’m a reasonably pleasant guy, I bathe every month whether I need it or not, and I’ll buy you lunch.

My only requirements are:

  1. Gotta be within an hour or so of Huntsville, Alabama. I need to be able to drive there and back on the same day. That basically means anywhere from Nashville, TN to Birmingham, AL, and from Florence, AL to maybe Scottsboro, AL.
  2. Gotta be Ruby. Rails is even better, but I’d go hang out with a pure Ruby hacker. This isn’t because other languages and contexts sux0r. It’s just that Ruby (and Rails) is what I’m doing right now, and where I’m hoping to ramp up my level of mastery quickly.
  3. You have to have done Pair Programming before, and can show me at least your way that works best. How do we set up our work space? Do we use two computers, linked up? One? Where do we sit? I don’t want to spend the day figuring it out with another Pair noob.

That’s it. I have a few preferences, but they’re not essential: I’d like to work with someone who does BDD/TDD so I can see it in action. I’d strongly prefer if whatever project we worked on was git-based (even better if it’s on github) for the same reason: I’d like to see how real work gets done in this mode. But honestly, any experienced Pair Programmer doing Ruby that will have me will work fine.

I don’t want money or credit or co-copyright or anything. I don’t care what the project you’re working on is. Anything is fine. I just want to learn, and hopefully contribute a little. If it works out, I’d like to do it some more, though no one should feel the slightest compunction against telling me, “Get lost, you bum!” after the first day.

I was inspired by Corey Haines’ Pair Programming Tour 2008. While I can’t travel around the country pairing up with awesome programmers, I’m free to travel around a little bit, and I know there are some good Ruby+Rails folks not too far away.

I’ve been programming more or less steadily for almost 30 years. I’ve been working with Rails for over 3 years, but only for private projects (one large one for one of my companies). In my career I’ve worked in a lot of different platforms, quite a few languages, and at various levels of OS, from a tiny bit of device drivers all the way out to user interfaces. I know a little about a lot of things, and a lot about a few things.

But the discipline of writing software moves very fast, and I’ve not been as deeply involved in programming as I’d like in the past few years, and frankly, there’s a lot of cool stuff I feel like I’ve missed. And one of those is the emergence of pair programming, and the BDD/TDD paradigm.

So…anyone willing to take me in and show me the ropes? Email me at rew@erebor.com, find me on Twitter, or call or text me at 256-777-7650.

Reblog this post [with Zemanta]
11
Mar

Is _why channeling Gay Talese?

   Posted by: rew   in Ruby, Writing

While reading Dan Poynter’s excellent piece on storyboarding, I was struck by the resemblance of Gay Talese’s storyboard to _why the lucky stiff’s Poignant Guide to Ruby.

Maybe it’s just me.

9
Dec

Google Charts’ simpleEncode in Ruby

   Posted by: rew   in Programming, Ruby

I couldn’t resist. Note the is_numeric? method, which is not very pretty Ruby (I should open up a base class somewhere and put it there), but it works and is only syntactic sugar anyway, to make the simpleEncode method itself a little nicer to read.

Note that it produces slightly different output than the PHP one, namely because Ruby handles integer arithmetic a little differently, thus the round() method was not needed here. If I changed this line:

      chartData < < simpleEncoding[simpleLength * val / maxValue];

to this:

      chartData < < simpleEncoding[(simpleLength * val.to_f / maxValue).round];

the output is identical. But visually they're nearly indistinguishable when charted, as the difference amounts to (literally) a rounding error at any given point.

def is_numeric?(arg)
  Float arg rescue false
end

def simpleEncode(values, maxValue=-1)
  simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
  simpleLength = simpleEncoding.size - 1

  # Just ignore any non-numeric values                                                               

  maxValue = values.select{|f| is_numeric?(f) }.max if maxValue < 0

  chartData = 's:'
  values.each do |val|
    if is_numeric?(val)
      chartData << simpleEncoding[(simpleLength * val.to_f / maxValue).round];
    else
      chartData << '_';
    end
  end
  return chartData;
end