3 ms·
I have a simple rule for shared libraries: only write them for things that are hard. Specialized algorithms; time/date calculations; complex custom business lo
by mabbo 5y ago
I have a simple rule for shared libraries: only write them for things that are hard.
Specialized algorithms; time/date calculations; complex custom business logic shared across the company; code generation libraries that generate code following best practices. These aren't always easy to get right.
But left padding strings or creating directories? These are less than 20 lines of code. The cost of using a library does not outweigh the risks when the benefit is that low.
- cowsandmilk 5y agoThis is an item that looks easy, but lots of people get wrong. Which is why a ton of languages now build it into their standard libraries…
- alecbz 5y agoLines of code != difficulty. There's tons and tons of different possible <20 line implementations for creating a directory + parents, many of which likely have subtle (or not-so-subtle) bugs.