DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Mustafa Turan
Mustafa Turan

Posted on

Zero Dependency Open Source

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:

  1. Implement your library functionality
  2. When you need an external dependency(external library from another author), create an interface instead of adding the dependency
  3. Document a sample implementation with/without dependency (but do not implement)
  4. 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.

Top comments (1)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.