Hacker News new | ask | show | jobs
by angryasian 5399 days ago
thanks for taking the time with this.

1. Any plans to update for 3.1 ?

2. I think its strange to address the dsl rspec for testing vs the standard rails unit test and not address other dsl like haml, sass, coffeescript (3.1). I think if you're going to go by rails community conventions vs rails framework convention then haml and sass should of been introduced.

2 comments

While I can't answer #1, I can give a reason for #2. When you're teaching people Ruby on Rails you would/should be teaching them what exists in the framework by default. The default templating language for views happens to be ERB-powered HTML, and so that should be taught.

Teaching haml and Rails at the same time would only confuse people as they will need to learn Rails AND haml at the same time. If anything, it would be better to introduce this as a "bonus chapter" or an appendix and let people choose for themselves rather than forcing them to learn something excessive.

Now, you may think that I would argue the same point for SCSS too. But now that SCSS is the default within Rails 3.1, it is "right" to teach it at the same time as Rails. The "leap" from CSS to SCSS is not as large as the one from HTML to haml, either.

>When you're teaching people Ruby on Rails you would/should be teaching them what exists in the framework by default.

this was exactly my point. You introduce RSpec rather than rails unit testing.

I would do the same thing, as Test::Unit's syntax is more confusing to a newbie than RSpec. For instance: assert_equal 2, @thing.method vs @thing.method.should == 2.

RSpec is also used by the majority of Rails developers (based on a random stat I pulled out of the air and due to my experience on many, many Rails projects) and it should be treated as the default, even though it is not.

> For instance: assert_equal 2, @thing.method vs @thing.method.should == 2.

...what makes you think this is less confusing? Test::Unit is blindingly simple, your assertions are plain old functions that take plain old arguments. I can build new assertions through simple function definition.

Rspec, on the other hand, adds methods to everything to let you structure your code so it reads like English. The goal here is not to be less confusing, but to be easier to read. RSpec is a lot harder to learn, and writing custom matchers is a lot more work than gluing together assertions.

Seriously, watch somebody new trying to figure out RSpec ... it's a bit of an ugly sight. Their first experience with automatic predicate matchers typically is a true wtf moment.

1. Maybe. I have no plans to teach Rails 3.1 for the rest of the year, but on the other hand writing about 3.1 will get me up to speed on the new features faster than simply writing some throwaway programs.

2. What Ryan Bigg said. :D I sometimes get a couple of extra hours at the end of a training course to teach topics like Haml, Devise, Paperclip, etc. But that's only if the students are experienced developers; I'd get in trouble if I put these topics in the course outline but couldn't cover them because the students had to take time to absorb the main topics.