Looking Inside of Little Black Boxes

In this series of articles, we are going to take a closer look at some of the utility libraries that every JavaScript developer is using (or should be using). Our goal will be to understand exactly what a function is doing so that we can use it more effectively and not be stumped when it doesn't work exactly as we expect.

"I've read Lodash's docs for each of the functions I use... so why should I look any closer?"

I have worked with JavaScript developers who have too many "black boxes": tools they rely on, but whose inner workings are a complete mystery. Just plug the right argument(s) in to the black box and get the right value(s) returned.

Part of being a "t-shaped" developer is knowing when to use one of your black boxes. If I'm working strictly on the front-end of an application and I need some manipulations to happen with data that is being returned to me via a connector to an API call, I may not have time or bandwidth to switch contexts and figure out this new problem. This is the ideal time to just give that particular black box a kick and hope it spits out what I need.

But if you are a JavaScript developer, common utility libraries that you rely on like Lodash, Ramda, Moment, etc. should not be complete black boxes. You should use them because they save you time and because you don't like reinventing wheels that already exist; but in a pinch, you should be able to roll your own solution that does the same (or nearly the same) thing that those utility functions do.

Next: Lodash's _assign()



Built-In Scalability vs. Adding Features


Built-In Scalability vs. Adding Features