[LRUG] [Chat] IronRuby

Jonathan Leighton j at jonathanleighton.com
Tue Jul 24 11:23:28 PDT 2007

On Tue, 2007-07-24 at 17:40 +0100, Tom Ward wrote:
> On 24/07/07, Jonathan Leighton <j at jonathanleighton.com> wrote:
> > Whether or not using an exception is better than using a conditional, if
> > you use an exception you can define a rescue_action in your
> > ApplicationController which allows you to generalise validation handling
> > across the entire application. From experience, that's really damn
> > useful (and less code etc bla bla bla).
> I'm afraid I'm even less of a fan of this pattern!  Three reasons:
> - Harder to read/understand

I agree with you on this. However, loads of things about Rails depend on
prior knowledge to understand. The rescue_action method is there for
this sort of thing and the fact that the bang method is used is a
(subtle) clue to how it works. I think particularly in smaller teams you
can get away with it.

> - Easy to screw up (forget the ! on save and you're screwed)

That's a bit like saying "forget the 'if foo.save...' conditional and
you're screwed".

> - My innate prejudice against exceptions for control flow

Exception *are* control flow ;) But I know what you're getting at. It's
good to be wary of exception usage by default, but I think it's also
fair to say both methods are valid and have their advantages. There are
probably much bigger things which are likely to make or break your Rails
project ;)

> Maybe I am going little crazy, our office seems to be getting stupidly
> hot.  Perhaps it's best  to agree to disagree.

Well I neither agree nor disagree with you so there we go :)

Jonathan Leighton, Web Developer

More information about the Chat mailing list