4 ms·
I think it mostly stems from the meme that "pure JS is best JS" and anyone who relies on "unnecessary" libs is somehow a worse dev than those who implement ever
by protonimitate 7y ago
I think it mostly stems from the meme that "pure JS is best JS" and anyone who relies on "unnecessary" libs is somehow a worse dev than those who implement everything by hand, regardless of if its required or not.
For personal projects, self education, or fun - go ahead and implement the entire lodash lib by hand! But in a business setting a 3.5kb reduction in bundle size and 10 hours spend refactoring the lodash code out of your project is probably a waste of time and money.
I'll agree with the advice that you shouldn't add dependencies until you need them, but saying "you never need lodash" is bad advice IMO. Absolutism is a bad quality to harbor, especially when it's over trivial things.
I know jQuery fell out of favor with the JS community and now is treated like a sign of incompetence but - just as everything in programming holy wars - at the end of the day everything is a tool, and you need to pick the right tool for the job. If the job is "get an MVP up as quickly as possible" and lodash/jQuery/underscore helps you do that, why wouldn't you use it?
- gmanley 7y agoPersonally one of the biggest red flags for me is when a developer doesn't use libraries and writes everything themselves. That opensource project with many contributors, that has been around for years is probably going to be better than what you can write in couple passes. There are obviously times when you need to do it yourself or the library truly is badly written but those times are rare. This gets a bit weird in the JS optimization world because it is true that each library and parts of the library you don't use are going to be extra useless bytes the user has to download. With tree shaking removing the parts of the library you don't use I think this becomes less of an issue.
- delinka 7y agoThe JS ecosystem has gotten so large that I can't possibly keep track of all the libraries that I could use to save myself trouble. This isn't helped by the fact that few tools & libs in that ecosystem state succinctly the problem they're attempting to solve.
- zawerf 7y agoI think the current meme/trend is to drop as many dependencies as possible. Which is probably the overcorrection of the previous trend of using single utility function libraries like "leftpad". I do agree with this specific instance though, that you should drop lodash. Historically lodash/underscore was written for a time before a lot of syntax/standard libraries were added. The new javascript features obviously had lodash in hindsight so they are pretty good at making common things syntactically easier to do or just straight up taking the good functions and standardizing it (e.g., spread operators, arrow functions, Object.assign, Array.flat, Array.flatMap, etc, etc)