Hacker News new | ask | show | jobs
by simoncion 3747 days ago
> First, you should never have a dependency for 15 lines.

If those 15 lines are called throughout your codebase, you should do what? Re-write the 15 lines and stuff them into a lib that you maintain? And everyone else should do this, too?

If a library is widely useful, it's widely useful regardless of how many LOC it contains.

1 comments

Yes. With dependency you are giving up control and in return you save time in not having to implement the dependency. If the LoC is small you get practically nothing in return and so the only reason to do it is ideological.

Many times it is even faster to write a trivial "module" yourself than even discover it on npm, let alone reading and verifying it. Hell, NPM 3.x is so slow that it's literally faster to write any 1 liner "module" than it is just to install it.

"Reuse" is just a means to an end, it doesn't make sense to do it only for its own sake.