[LRUG] [Chat] IronRuby

Pratik Naik pratik at thinkwares.com
Tue Jul 24 07:13:29 PDT 2007


It's not about one way being better than the other. It just reflects
how you persue things. When you take rescue approach, your main code
is only the perfect use case, instead of handling "things that could
go wrong" in the same block.

I believe it also helps you keep the logic seperate for perfect use of
an API and when someone screws up.

We all know the difference between save and save! So that example is
not very helpful.

But imagine something like http://pastie.caboo.se/81719

I'm not saying it's a better way. I'm just saying that it's not a
wrong way either.

> Why is that better than
>
>   def create
>     @person = Person.new(params[:person])
>     if @person.save
>       redirect_to :index
>     else
>       render :action => "new"
>     end
>   end
>
> ?
>
>
> --
> * J *
>   ~
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



More information about the Chat mailing list