Central Virginia Ruby Enthusiasts Group (CVREG)

Richmond's Premiere Ruby Users Group

Welcome to the CVREG!

March Meeting: Better Coding with Ruby Lambdas with Keith Bennett

Details

  • Date: Tuesday, March 11
  • Time: 18:00-20:00
  • Place: 804RVA 1657 W. Broad St. #3, Richmond, VA ()
  • RSVP: Meetup.com

Better Coding with Ruby Lambdas

The Problem

Object Oriented Design is powerful for organizing software behavior, but without the benefit of lambdas' code-as-data flexibility, it fails to reduce solutions to their simplest form.

Functional programming has been gaining popularity, and many Rubyists have embraced functional languages such as Clojure. While Ruby generally isn't considered a functional language, it does have lambdas and a rich Enumerable library.

Although Ruby's Enumerable functionality is widely appreciated and used, its lambdas generally are not.

The Solution

This presentation introduces the developer to lambdas, and shows how they can be used to write software that is cleaner, simpler, and more flexible.

We'll go through lots of code fragments, exploring diverse ways of exploiting the power of lambdas, and identifying reusable functional design patterns along the way.

Topics covered will include:

  • a short introduction to lambdas, including the 1.9+ syntax
  • using 'currying' and 'partial application' to simplify the use of lambdas
  • assembling composite predicates, transformers, etc., using lambdas and Enumerable methods
  • injecting deferred behavior using lambdas with consistent signatures
  • a simple scheme for configuring conditional behavior using lambdas
  • contrasting the duck typing and lambda approaches
  • using lambdas as nested functions to minimize scope and improve code clarity.

Keith Bennett

Upcoming Meetings

April 8, 2014
Metaprogramming Sass with Ken Collins
April 29, 2014
Datomic with Craig Andera (Joint meeting w/ Data Hackers)
Contact us to suggest speakers or become one yourself!