DEV Community

Discussion on: Design pattern: JS Functional Chains

Collapse
 
patrixr profile image
Patrick R

Most of his arguments are against the lodash chain specifically, not the pattern itself.

I don't think he even believes chain style APIs are evil.

I'm not using lodash at all here. It's about the potential vanilla implementation of such pattern.

Which in itself has both good use cases and poor ones. Far from a crime :)

Collapse
 
ironsavior profile image
Erik Elmore

There is a broader wisdom to take from the post I referenced. The lesson is that method chaining as API comes at a cost in terms of design simplicity and consistency. This specific case is explained in terms of lodash chaining, but the reason it's not good for lodash is because the chain style API doesn't work well as a means of composing functions--which is fundamentally what your post is about.

Thread Thread
 
patrixr profile image
Patrick R • Edited

Not denying there are caveats to the pattern. The implementation is still interesting in my eyes.
I appreciate your second comment for the constructive details. My concern is more with click-baity titles :)