On 5 Aug 2014, at 4:24 pm, Tim Moore <[email protected]> wrote:
> One thing that hasn't been mentioned yet, and which unfortunately I couldn't 
> really address in the talk without a long tangent, is why would you want to 
> write code like this in the first place? Is a proc in a case statement 
> anything but a useless, overly-clever bit of language esoterica?

I had the same thought. After some musing, I came to the conclusion that you 
should opt for simpler code using simple concepts and cop the penalty of it 
being more verbose. Not everyone will agree I'm sure, and that's cool.

The advantages of having simpler code using simple concepts is that your code 
is now more easily understood by other developers with a lower level of Ruby 
knowledge.  This is the same reason I try to not perform Ruby gymnastics in 
tests. If I do decide to use some more complex code, I use comments to explain 
what I'm doing.

This was probably more important back in the day when hardly anyone used Ruby, 
but I still follow it.

If you're just consuming gems (not authoring them) and say, coding in Rails, 
you'll rarely have a need to use Proc or similar concepts. So when you're 
learning, I'd say don't bother with Proc and fancy Ruby concepts. Learn other 
things that will get you more productive at a faster rate.

Dan


Dan Harper
[email protected]
Mobile:  0414 344 233


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rails-oceania.
For more options, visit https://groups.google.com/d/optout.

Reply via email to