When to write your own code and when to use an existing library
This is more like general advice, but when possible minimize dependencies.
I will write the following examples with Ruby gems in mind but could be used in any other programming environment that supports packages.
Of course, there are pros and cons to using external packages.
What are some advantages of using external dependencies:
In general, I think you are using a library you should consider contributing to it in any way you can.
But let’s talk about disadvantages:
I am using a simple heuristic to decide when to use a library and when to implement your own code.
As a general rule:
Write your own code if the code that you are about to write is simple.
Also, write your code:
As a general rule:
Do not write your own code if the code you are about to write could be something complex or is in a domain that could have multiple unknowns and there is already a library providing a solution
Do not write your own code: