Eric has posted 96 posts at DZone. View Full User Profile

Better Ruby Through Functional Programming

  • submit to reddit
Functional Programming is useful in many areas of development besides concurrency.  In this follow up talk to the "Better Ruby Through Functional Programming" presentation in 2008, Dean Wampler, a former consultant from ObjectMentor, explains the functional-like features that Ruby already supports and how these functional programming ideas can improve your code.  

In Ruby you can make variables immutable (value objects) and you can also write functions that have no side effects.   This means the functions don't modify any global and object state, and all the work they do is returned by the functions.  These characteristics can greatly reduce the amount of bugs in your code and make concurrency easier.  Ruby already supports functions as "first class citizens" and closures are anonymous functions.  Wampler will further explore the functional-style concurrency in Ruby, using the Actor model as one example.  Wampler will also explain even more useful functional techniques, giving you more appreciation for functional programming.
Published at DZone with permission of its author, Eric Hagan.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)