Today we are going to focus on whether reinventing the wheel (in terms of coding our own software) is better than using existing code alternatives. Many people have different opinions on this topic, and while I have my own, I will try to have an unbiased vision. Let’s get started!
I hate reusing code 😒
This is often a very good choice, contrary to popular belief in some cases. The main advantage is that you’ve got full control over the software, which is often essential, but you will have to deal with your own bugs which is a good or a bad thing depending on how active other alternatives are.
Evaluating an already made module is very time consuming if you are worried about security and/or performance.1 Which you should be. Furthermore, some shortcomings will surface only after extensive use, when it’s too late to switch to another better alternative.
There is as little code to understand as possible, as the implementation is your own. This is a large benefit when you need to write an extension as there is less code to understand and to modify.
Extending an already made module causes a big communication overhead (discussions with the developers maintaining the ready-made project). On the other hand, branching the code is untempting because you won’t be able to reap benefits from bugfixes and extensions.
All previous remarks assume the project in question is open source. In most cases, when using a closed source project, there is far too little documentation available. This is especially true for big and legacy frameworks.
The license agreement of the project you are thinking about to use may also be too strict.
Open source rules! 😎
If you need a performant and already tested module, search for popular open source projects before starting your own, mainly because:
- The functionality already exists and is known to be stable. Moreover, you are going to create another alternative that won’t add anything new.
- Your version will most likely introduce bugs or constraints (e.g. your version isn’t thread-safe).
- As the group of people that will be working with your own implementation are close to you, you most likely won’t try to create a good documentation because you don’t plan to make it open source.
- Unit tests are important! Most open-source alternatives will have unit tests and your version will be lacking them, and if you add them, you will become to see that your project isn’t as performant as you thought.
There certainly are situations in which code reuse is the best option, but it is not always the best choice. The context of code reuse in software development is certainly different from reusing bricks when building a wall or removing the doors from a car design.