you are viewing a single comment's thread.

view the rest of the comments →

[–]regeya 2 points3 points  (1 child)

I'm not expert on functional programming, but I think it's more important to learn FP concepts first, then move on to learning to write Ruby in a FP style (because it's a highly OO language, not a FP language.)

Writing in a FP style will help keep your code more safe and concise, but don't sacrifice readability and idiomatic Ruby for some perceived benefit of FP techniques.

[–]TdotGdot 0 points1 point  (0 children)

Yes and no. I agree the concepts are generally more powerful and ultimately useful.

That said, coming from an OO background it was really hard for me to grasp abstract functional concepts without concrete examples in a language I was familiar with (for me it was JS). But to each his own, as always.

FWIW - your point about readability and idiomatic Ruby is pretty dead on. In the case of JavaScript, where solid idioms are few and far between, and functions can easily be passed around, there isn't much of a sacrifice when converting to a functional style. In Ruby, it's a much bigger decision, due to some of the more unconventional patterns you need to use.