r/javascript • • May 28 '19

What are some JavaScript things beginners don't know?

333 Upvotes

383 comments sorted by

View all comments

2

u/erulabs May 28 '19

Using abstraction libraries should be carefully considered, not thrown around like a favorite set of tools. The number of times I've seen Ramda in a code base that used to be readable...

Bonus: Understanding the cost of simplicity over artifact size. I've had developers spend multiple days pulling out lodash and inlining 1/8th of it into the codebase to "reduce node_modules size". The size of node_modules is fine, please get back to work on things that matter (I promise a single unsanitized input is always worse than making an AWS machine with a 10gbps network card download 10mb - trust me, it will be FINE). No one seems to care about that SQL query that's shipping 50mb over the network, but 50mb of node_modules and suddenly everyone loses their minds!

</grumpy-ops-rant>

1

u/aot2002 May 28 '19

They could always use npm-lazy if they want to cache it for multiple machines.

1

u/erulabs May 28 '19

npm-lazy

Haven't heard of this, but yarn already caches properly - the install time is very short, but for some reason the size of the directory comes up continually. No one seems to bat an eye at my Packer build which apt-get's about 3gb of applications - probably because they aren't aware. Anyways, my point is some Node developers tend to think of dependencies as a bad thing that should only ever be used in extreme need - getting the work done is always more important than bundle size. I can reduce bundle size easily - what I can't do is guess why you wrote your own file-system abstraction or Promise system, 6 months after you've quit and found a new job.