Why import a package while several lines script are or so equally effective?

  • Well established solution that doesn’t require any effort/knowledge to implement/easier to remember.
  • Ideally a package is maintained, and any further issues are fixed for you.
  • API is usually much cleaner (but can be opinionated and not ideal).
  • Usually provides a more general/proper/robust solution that’s applicable to more use cases.

Though, having read quite a few packages…I can tell that the (vast?) majority are made by beginners or so, which results in not so elegant/efficient and error-prone solutions. But depending on the complexity, even the most robust and thought-through packages can have bugs, no matter the skill level.

You can just straight up copy the package implementation and use it, or strip it down to your specific use case. You have to decide what are your priorities and choose a solution accordingly.

3 Likes