Jan 15 2008

RSpec + JRuby

dastels @ 10:17 pm

My coworker, Paul Zabelin, posted here on some ideas that we’ve been experimenting with using RSpec stories and JRuby.

Tags: 

Jan 15 2008

New and Improved: RSpec 1.1.2

dastels @ 3:48 am

Tonight RSpec-1.1.2 was released. See most of the details on David Chelimsky’s blog.

I take a personal interest in this release as it includes my first active submission to the codebase in some time.

The functionality I added relates to the definition of steps in the new story component. Up until now, you used a string to define a step. For example:

Given "a student named '$name'" do |name|
  #...
end

When "the student is given a grade of $grade" do |grade|
  #...
end

Then "the student should $pass_fail" do |pass_fail|
  #...
end

This would result in stories like the following:

Given a student named 'Mike'
When the student is given a grade of 40
Then the student should fail

Continually talking about “the student” is grating and very un-natural sounding. Sounds downright, bloody legalistic, actually. And a lawyer is the last thing we want to be accused of sounding like… other than maybe Denny Crane.

One approach to this would be to go to something like:

When "he is given a grade of $grade" do |grade|
  #...
end

Then "he should $pass_fail" do |pass_fail|
  #...
end

which would give us:

Given a student named "Mike"
When he is given a grade of 40
Then he should fail

Now, speaking of lawyers, we probably want to make this a little more PC and be able to do this:

Given a student named "Michelle"
When she is given a grade of 60
Then she should pass

We could conceivable create another set of steps for the feminine forms, refactoring to remove the duplication. That might suffice in the simple case, but it’s still rather crude. I’d like to be able to use a regular expression and create steps something like:

When /(he|she) is given a grade of (.*?)/ do |pronoun, grade|
  #...
end

Then /(he|she) should (.*?)/ do |pronoun, pass_fail|
  #...
end

With release 1.1.2, that’s exactly what you can do.

There are a couple things to point out:

  1. Alternatives need to be in a group to limit their scope.
  2. Whatever matches groups such as that (and any others) will be sent into the supplied block as arguments. As such they need to be accommodated by having a block parameter for each of them.
  3. Since this is already a regexp, no internal processing is done to it. With string step names, variables (of the form $<identifier>) are rewritten as (.*?). When using a regexp as the step name where there are variables, we much do this rewriting ourselves.

This new feature provides a new level of flexibility in defining story steps. Have fun with it.

Tags: 

Nov 05 2007

RubyConf 2007

dastels @ 8:04 am

I’m sitting in the airport in Charlotte, on my way home from RubyConf2007.

What a fabulous conference. This the most enjoyable conference I’ve been to in a very long time.

There was so many great talks/ideas/projects, it’s hard to pick highpoints, but these stand out for me (in no particular order):

  • drnic for some very cool tech and sheer entertainment value.
  • Laurent Sansonetti for a jaw-dropping talk/demo about what’s possible with the latest Ruby love from Apple.
  • Charlie & Tom on JRuby
  • Evan on Rubinius… that is one cool project… sign me up
  • and, of course, Matz’s keynote

It’s no wonder the Ruby community is “nice people” when we have someone like Matz at the head of it.

Maybe as rewarding, or even more, than the tech & talks was seeing old friends again and meeting others face to face that to date I’d only known online.

It was an awesome weekend, and I’m eagerly looking forward to the next Ruby conference!

Tags: 

Sep 21 2007

Emacs once again

dastels @ 9:02 pm

With my move to Google, I’ll be in a mixed Linux/OSX environment… so it makes sense to me to revisit emacs for my day-to-day programming. 

With some help from zenspider and technomancy, I have the latest carbonized emacs up & running with a nice ruby/rails environment (rinari)… and of course… the zenburn color scheme.

Tags: 

Sep 19 2007

Everyone’s a pirate

dastels @ 5:23 pm

Seen on #caboose:

courtenay: we uses arrrrrrrspec

Tags: 

Sep 18 2007

Yarrr! It be that time o’ the year again!

dastels @ 8:49 pm

You got it.  Tomorrow is International Talk Like a Pirate Day.

Tags: 

Sep 18 2007

A Microsoft moment

dastels @ 7:36 pm

I just added a confirmation dialog to a cancel button on an app that I’m working on. I tested it and stopped for a second as I read the dialog.. then broke out laughing.

cancel-or-cancel.png

What do I press if I really do want to cancel?

Tags: 

Sep 17 2007

Comments on

dastels @ 10:34 pm

I’ve turned on comments… with fairly heavy moderation… we’ll see how it goes.

Tags: 

Sep 17 2007

The Art of Computer Programming

dastels @ 10:29 pm

Tonight I was exploring the current state of RubyCocoa (and it looks good), and I noticed a quote from Knuth’s “The Art of Computer Programming”, his 1974 ACM Turing Award Lecture.

Paul Graham has the text of the full lecture here.

This is a great talk, and should be required reading for anyone calling themselves a programmer. I found the last section, especially interesting.. here’s what I consider to be the core bit form it:

“Therefore I want to address my closing remarks to the system programmers and the machine designers who produce the systems that the rest of us must work with. Please, give us tools that are a pleasure to use, especially for our routine assignments, instead of providing something we have to fight with. Please, give us tools that encourage us to write better programs, by enhancing our pleasure when we do so.”

It struck me that Ruby and recent systems from Apple fill Knuth’s request quite nicely. According to Wikipedia, Knuth uses Macs.. I wonder how he thinks they answer his challenge from ‘74. I wonder what his view of Ruby is… Anyone heard anything about that?

Tags: 

Sep 11 2007

The times, they are a-changin’

dastels @ 11:37 pm

Steve Jobs isn’t the only one who can quote Dylan.

… speaking of Steve Jobs and changin’ times… I may be bumping into Mr. Jobs at the local Cupertino Starbucks before long…

Next month I’m heading to California… Silicon Valley to be specific.

After over 3 years of saying “I’m not interested” to Google, I’ve accepted their offer of a position. I’m not sure how public I can be yet about what exactly I’ll be doing… but it will leverage my experience and expertise in Agile Development, TDD, Ruby, Rails, and RSpec.

This change is not without some sacrifices, but we think it’s the right move at this time. One downside is having to end my association with Obtiva… which I have greatly enjoyed. They’re great people and great to work with.

One benefit is that I won’t be having to focus so much on billable hours to cover the bills anymore… so there should be more time for things like RSpec and writing.

Tags: 

« Previous PageNext Page »