Zero Dependency Open Source
Mustafa Turan
Posted on May 2, 2019
Writing a zero-dependency open-source library could be the way to bring an immortal contribution to the developer communities. Adding dependencies to your open-source will bring many update/upgrade work while your busy life goes on. And you/community may give-up one day to update those dependencies because of several reasons. Even the zero-dependency library might need language version updates. So, the real intention is keeping as minimum dependency as possible.
Instead of putting dependencies, put interfaces to the library and let the library users to use their own choice of libraries by implementing your interface. And share sample implementations with a dependent library as an example instead of directly adding implementation. (What is being defined is also a part of hexagonal-architecture pattern for software design which makes the library optioned without implementation choices.)
4 steps to provide zero-dependency library:
- Implement your library functionality
- When you need an external dependency(external library from another author), create an interface instead of adding the dependency
- Document a sample implementation with/without dependency (but do not implement)
- Let the library user decide what to use & leave the interface implementation to the library user.
This could be the way to bring an immortal contribution to the developer communities. Since there will be no dependency, the library can be used for new projects/libraries with different implementation details. Even after years, new implementations would be possible without updating the library...
Before taking action, it is highly recommended also reading DHH's Rails is Omakase post. More ideas are highly welcome. Let's discuss.
Posted on May 2, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.