Hacker News new | ask | show | jobs
by SketchySeaBeast 2311 days ago
> People find it too unpleasant to buckle down and type out that combination of string functions to left pad. It is less cognitive work to down load some library.

That's not the case though - why would I reinvent the wheel when I have finite time to get something done? I love to suss out solutions to all sorts of things on my own time, but if I have to left pad a field, I've already got lodash, I'm using that.

In addition, when someone goes back to read the code "_.padStart" just makes sense to read.

I'm not saying that understanding doesn't lead in repetition and effort, but I think you're wrong on why people use libraries. It's not because people don't want to know, they gotta get whatever it is they are working on done.

1 comments

Another reason to use a library is once you write that left pad function yourself, you have to go copy it around from project to project whenever you need it, then fix or improve it and copy the changes all over again. Second time you do that, might as well pull it into a library. And now you have a library that you lug around, might as well host it somewhere. In a few short decades you roll your own package management infrastructure and fill it with all kinds of useful things like string concatenation subroutines and macros for flow control primitives built on jmp instructions and stuff like that.

Might as well shortcut all that and see if there is something in standard library or in an existing package...