3 ms·
Obscure jargon and custom methods are always going to be perceived as clever. Personally I don't think this var totals = splat(get('total'))(orders); is
by ricardobeat 14y ago
Obscure jargon and custom methods are always going to be perceived as clever.
Personally I don't think this
var totals = splat(get('total'))(orders);
is an improvement over
var totals = _.pluck(orders, 'total');
Why? Because the latter has a single layer of abstraction - what does `pluck` do? - while for the former you have to learn about `splat`, `get` and their internal behaviour/return values, specially if my jargon is not exactly the same as this library's jargon.
We've had the exact same discussion over Promises: people favor a slightly less convenient syntax over too many layers of abstraction. If you have a large codebase where the functional methods are really going to help, great, go on and put a note on the readme to guide other developers before they encounter it; but unless a specific implementation/library becomes hugely popular it's not going to fare well in public or small projects, and will be seen as clever, opaque code.
edit: sorry, I misread the 'is a small incremental improvement' as referring to the underscore method. Keeping the post for discussion anyway.
- raganwald 14y agoThe post doesn't say it is an improvement, it says that Underscore is deservedly popular and also that both are jargon. UPDATE: I will probably clarify that in the code. But if you want to open the door into my madness, the use case for "splat" is that it's a combinator, a function that takes a function and returns a function. So if you like "pluck" as I do, you write: var pluck = compose(splat, get); // ... var totals = pluck('total')(orders); And you wouldn't really write `splat(get('total'))` either. Having building blocks that are combinators rather than general-purpose functions is itself a family of jargon. It's a win if you do a lot of method decoration and function composition, otherwise it's... Clever.
- deleted 14y ago[deleted]
- dasil003 14y agoRe: Promises: According to the last article that was posted here, the point of Promises is to provide greater semantic information that assists in organizing the dependencies and prevents subtle race conditions, it is not simply syntactic sugar on callbacks. I'm not prepared to defend that position, but the article made a compelling case.
- ricardobeat 14y agoYes, that was a great read. What I mean is that the overhead of understanding and keeping the abstractions in your head (promise object, resolve/defer/reject, returned promises, chaining) almost nullifies the advantages it offers. I think promises are great in some circumstances, but unless they catch on as a standard way of working with async calls, they will remain just a 'clever' thing you can use, but most developers won't understand, and will make your code incompatible with everyone else's. It's a chicken and egg problem.