Managing Code Components with Bit
As the world moves to software architecture based on microservices and multiple repositories, the ecosystem struggles to keep code bases maintainable. From monoliths to publishing hundreds of micro-packages, solutions try to battle growing code duplications across repositories. Bit is a new OSS distributed code component manager built to make components reusable across repositories, and much more.
In this article, Bit team member Jonathan explains the idea behind this new approach to managing code, which has hit the ground running as one of the most popular repositories on GitHub.
The Problem with Code Duplications
Most developers are all too familiar with code duplications. Usually, these are the direct result of copy-pasting small code components and snippets across repositories. Sometimes, duplications are the result of stopping to reinvent small components time after time. As the use of microservices and multiple repositories increases, managing reusable components across repositories becomes a painful issue. Maintaining duplicated code snippets in multiple places becomes a growing headache, and breaking changes become an everyday trouble. This phenomenon touches everyone, including some of the leading JS open-source projects on GitHub. For example, here are 4 of the over 100 different implementations of a simple
isString functionality in GitHub’s top 10K repositories:
The time invested in reinventing the wheel would probably have been better invested in breeding creation. The duplications across repositories (which are not a part of the same code base in this particular example) makes maintenance an odyssey.
To battle this problem, the ecosystem developed different solutions from gigantic monolith applications used in huge enterprises such as Google, Facebook and others and to community leaders publishing hundreds of components to package managers such as npm. Both solutions are not optimal for most people.
While the first has its pros and cons, it simply isn’t practical for most of us. Building and maintaining a giant monorepo application simply isn’t practical for most developers and teams. Using npm as a duplication free snippet base takes an incredible amount of time and effort, while having multiple shortcomings created simply because traditional package managers were not built to benefit from managing small components: runtime dependency resolution is slow, versioning is complicated, packages are hard to find, they don’t take care of CI, they require the creation and maintenance of multiple tools (Git, Packages, CI etc.) and add unnecessary weight and complexity. Practically speaking, most of us simply don’t have hundreds of components used as micro-packages.
Addressing the problem of making small components reusable requires a tool built specifically for this job; a tool allowing components to be make without overhead or initial configuration; a way to make sure these components are easy to find, and are maintained and taken care of throughout their entire lifecycle including simpler versioning, faster dependency management and even build and test execution. To achieve this, a new, open-source code component manager named Bit was designed from scratch, custom built to make small component reusable.
Continue reading %Managing Code Components with Bit%