February 2008 Archives

AddThis Social Bookmark Button

The Problem

I find Ruby’s current warning system, if you can call it that, lacking. Warnings are controlled by the -W flag on the command line, and are generated via the Kernel#warn method within code. There are a host of problems with this approach to warnings.

Gregory Brown

AddThis Social Bookmark Button

Interesting:

I asked a question on Phlip’s last post about whether assert { 2.0 } was really necessary, given that it’s mostly just assert_block from Test::Unit. I noticed this question disappeared from the post, because I guess it was offensive somehow.

Though it made it through the second time around and Phlip answered reasonably, he sent me a private email explaining that he had censored me because I apparently don’t “get” assert { 2.0 }.

Not to pick a fight, but I personally believe that blog posts that have comments turned on should only be moderated for spam and/or abuse, which my comment was neither of. If you’ve got some questions about assert { 2.0 } that you’d like to see stay online without silent censorship, feel free to post them here.

This hopefully serves as a simple reminder that we should keep up with the ‘open’ in open source, and not silence technical questions randomly.

AddThis Social Bookmark Button

I like developer tests, but I don’t like the primitive assertions - assert_equal, assert_match, assert_not_nil, etc. They only exist for one reason - to print out their input values when they fail. And they don’t even reflect their variable names.

So I wrote an assertion to replace all of them. Put whatever you want into it; it prints out your expression, and all its values. Essentially like this:

__source__ __failure_diagnostic__
x = 43
assert{ x == 42 }
assert{ x == 42 } --> false - should pass
    x --> 43
deny{ x == 43 }
deny{ x == 43 } --> true - should not pass
    x --> 43

The classic versions require a lot more typing, and reflect much less information:

  assert_equal(x, 42)     --> <43> expected but was \n<42> 
  assert_not_equal(x, 43) --> <43> expected to be != to \n<43>

Install this system with:

  gem install assert2

Some systems might require sudo, to tell the ‘puter who’s boss. The “assert2” gem will pull in RubyNode, the library that inspects Ruby blocks. Then add require 'assert2' to your test suites, or to your test_helper.rb file.

Gregory Brown

AddThis Social Bookmark Button

The title of this post is the title of a talk I’ll be giving at NYC Ruby on February 12th.

Aside from blatent self promotion, I’m actually posting in search of opinions and thoughts to incorporate into this discussion, so that I can give a little more of a balanced account beyond my own crazy ideas.

Here’s my short and rather vague description of what I’ll be talking about:

Lots of people come to Ruby or stick with it because of the community, but what does that mean? In this short talk, we’ll take a look at what the Ruby community has meant over time, what it means now, why it’s dead, and why that’s not a bad thing. Not quite as depressing as it sounds, this talk will focus on how specialized groups such as local Ruby communities, regional conferences, and individual projects have developed their own distinct culture while still being impacted by the Ruby community of old.

What I’d like to know is what readers here have experienced with both “The Ruby Community” as well as Ruby communities in general. This could range anywhere from describing the general feel of your local Ruby users group to picking a bone with some of the ‘untouchable’ aspects of Ruby culture.

I’ve been trying to make my talks a bit more interactive in a sense, hoping to simply set up a discussion rather than pontificate, so having hearing your opinions will help me do that. In return, I promise to write another post titled “Why the Ruby community matters, and why it doesn’t” which will summarize any thoughts people have shared as well as the content of next week’s talk.

Anyway, looking forward to your thoughts. Feel free to be as bold as you’d like, and if you don’t want to be credited for your words, just post anonymously.