Deprecating `fail`, `smash`, `miss`, `hold`

2 views
Skip to first unread message

AJ ONeal

unread,
Oct 19, 2010, 2:04:53 AM10/19/10
to futures-j...@googlegroups.com
After working with Node.js for a bit I've decided that passing both the error and the data to the same function encourages me to write better code.

.when(function (err, data) {
   if (err) {
     throw new Error(err);
   }
   console.log(data);
})

It relieves, ever so subtly, the mental burdon of "considering the error case".

I probably won't remove those methods until a version 2.0 in the semi-distant future, but know that they will probably be removed.

I've also written an AbstractHttpRequest (AHR) that wraps around jQuery 
(I didn't want to do all of the browser correction for XHR and jsonp myself)
that passes back `err, data, xhr`.

So far it only exists in CampusBooksJS, but it will become its own minimodule once I add Node support.

AJ ONeal

Tauren Mills

unread,
Oct 19, 2010, 4:42:09 PM10/19/10
to futures-j...@googlegroups.com
AJ,

I don't use any of those. I'm glad to see you are simplifying the API.  One thing that bothered me about your implementation is all the extra fluff.

Tauren


--
Please use prefixes: [Pony] Feature requests, [TestCase] Test cases, [Bug] if you're lazy. If you have contract work or position for FuturesJS devs, prefix [Bounty] or [Job].
-----
To post to this group, send email to futures-j...@googlegroups.com
To unsubscribe from this group, send email to
futures-javascr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/futures-javascript?hl=en

AJ ONeal

unread,
Oct 19, 2010, 4:49:06 PM10/19/10
to futures-j...@googlegroups.com
What other "extra fluff", for example? What else would it be good to get rid of? Or to perhaps be an add-on?

AJ ONeal

Tauren Mills

unread,
Oct 19, 2010, 5:08:21 PM10/19/10
to futures-j...@googlegroups.com
AJ,

Sorry to be so abstract. I don't have time at the moment to look for specifics. I'm just saying that the API seemed overly verbose. So removing and/or consolidating some functions seems like a good idea. I don't have concrete examples, I've just found that I only use a small set of all the functions available in the library. Then again, I'm probably not taking advantage of it as well as I could be.

Tauren
Reply all
Reply to author
Forward
0 new messages