Justin du Coeur (jducoeur) wrote,
Justin du Coeur
jducoeur

The joy of discovery

I wound up surfing this morning -- I was looking for a specific UI gadget (an AJAX-smart, jQuery UI-based, sortable list window), and decided to just spend some time wandering through jQuery plugins.

I just discovered Underscore.js. Why didn't I already know this existed?

From the look of it, this is one of those packages that most beginner-level Javascript programmers would just scratch their heads at, but many serious programmers would give their right arm for. The concept is very simple: it adds Javascript implementations of all of the standard functional-programming methods that you routinely expect in a serious modern language. It looks magnificently comprehensive; highlights that I am noticing include:

-- _.reduce() provides what I think of as foldLeft (probably the most important utility-belt function for working in collections)
-- A general _.filter() function for collections
-- Array-manipulation functions that treat Arrays like Lists in most languages (head, tail, zip, and that sort of thing)
-- _.partial binds some of the arguments to a function, providing basic currying
-- A general-purpose _memoize() function, which is one of the easiest and safest ways to optimize a lot of problems

And so on. I gather that it is designed to complement jQuery, using _ as the magic character where jQuery uses $.

Anyway, it looks delightful. I expect Querki will pick this up quite soon, and I commend it to any serious programmers who are trying to use Javascript and tearing their hair out over the frustrations of the language. (Yes, you can make life a bit easier with CoffeeScript, but this provides *tons* more tools than that. I suspect you still want it for sophisticated problems, even with CoffeeScript.)
Tags: programming
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments