Hello friends,
I know most of you have probably heard of Moose already. Many of you have probably even used it. I am certainly not one to claim I'm the first on any given block. But, after finally bucking up and building something with it, I felt a burning itch (maybe I should get that checked out?) to share my enthusiasm.
I wrote an interface to access data from a website. I do this a lot, but the busywork involved in making even a very simple OO API usually prevents me from bothering. Mostly, I write a couple of subroutines to abstract the various WWW::Mechanize and HTML::TreeBuilder bits, build some plain data structures, and hack things up and down the stack.
On a lark, I thought I might want to do it a little differently this time. I installed Moose, went through the docs a bit, and discovered the development model was surprisingly fun. Even while learning how to prod things into the proper shape.
The beginning was crude and simple. I defined the attributes of each object with has calls, and the object interrelationships with isa declarations. The basic data model took very little time to get right. I quickly had a program that pretended it was reading my LibraryThing library.
Then I wrote default hooks that fetched the appropriate data from the site. It kind of snuck on me, but then I realized that's all I had to do. Once I had the loading code in place, it was done. I had a functional API before I even knew it. It was clear and straightforward. Even better, since the data-fetching methods were all defined with lazy turned on, the fetching doesn't happen until the data's needed.
There is a lot of functionality that comes from Moose's simple, declarative interface. All I could think of was the infamous tagline from a Ruby on Rails promotional video: look at all the things I'm not doing! I gotta say, Moose; I like it, I really do.
Three cheers for stvn!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Moose is lovely
by ysth (Canon) on Feb 29, 2008 at 01:49 UTC | |
by revdiablo (Prior) on Feb 29, 2008 at 06:42 UTC | |
by stvn (Monsignor) on Feb 29, 2008 at 17:29 UTC | |
by revdiablo (Prior) on Feb 29, 2008 at 20:26 UTC | |
by stvn (Monsignor) on Feb 29, 2008 at 22:26 UTC | |
by ysth (Canon) on Feb 29, 2008 at 19:32 UTC | |
by stvn (Monsignor) on Feb 29, 2008 at 20:02 UTC | |
by nothingmuch (Priest) on Feb 29, 2008 at 20:09 UTC | |
by meraxes (Friar) on Feb 29, 2008 at 17:27 UTC | |
by stvn (Monsignor) on Feb 29, 2008 at 18:09 UTC | |
Re: Moose is lovely
by Your Mother (Archbishop) on Feb 29, 2008 at 21:24 UTC | |
Re: Moose is lovely
by Anonymous Monk on Feb 29, 2008 at 04:19 UTC | |
by revdiablo (Prior) on Feb 29, 2008 at 06:47 UTC |