Bit is a new open source project built to write code once and use it across different repositories, projects, and applications. With Bit, you can create and model server, web, or even serverless components in a virtual repository, forming a dynamic API containing nothing but the code actually used in your application. Bit components can be reused without the overhead of configuring and maintaining multiple repositories and packages.
The Unix Philisophy encourages the building of software out of smaller, isolated components. Building a code base out of a virtual composition of reusable building blocks is a future which begins in the technological ability to easily create, find, and reuse code components in different contexts without having to duplicate hard-coded functionalities.
Bit allows us to create and model components on a virtual Scope, making them reusable across our different projects without having to spend endless times and effort on creating and configuring multiple repositories and packages.
The Problem With Micro-packages
After multiple painful attempts to use package managers to build an army of reusable components, it's safe to say there are three major problems which make micro-packages an impractical solution for the problem:
1. Initial overhead: Creating a new repository and package for every small component isn't practical. In practice, no one (or almost no one) has the time and effort required to do it. Those who do are willing to pay the price of having to create a new VCS repository, create and configure a package boilerplate (build, testing, etc.), and do that again and again for hundreds or thousands of small components.
2. Maintainability: Modifying a repository and a package forces you to go through multiple steps (e.g. cloning, linking, debugging, republishing etc.) for every little change you want to perform. Build and install times quickly increase and dependencies become the monster under your bed.
3. Discoverability: packages are hard to find. Organizing and searching through hundreds of micro-packages is an odyssey on its own, let alone knowing which ones to trust and use. We all remember the left-pad incident all too well, and who can tell how many micro-packages are out there to perform the small task we need right now? Here are a couple of examples.
This realization lead us to rethink the paradigm of how code components should be made reusable and turned into building blocks. We created a new paradigm based on three matching principles: components should be quick to create, simple to maintain, and easy to find. To bring theory into practice, we created Bit and released it to GitHub after using it ourselves.
Bit: Code Components as Virtual Building Blocks
Bit is a virtualized code component repository. It adds a virtualized level of abstraction on top of your source files, allowing you to easily create, maintain, and reuse code components. It is designed from the ground up to suit code components. Bit components can be created and maintained with very little work and overhead. They can be used anywhere as a dynamic API made only of the code actually used in your application. It allows single developers or teams to set a distributed Scope anywhere to export and reuse components, or connect to the Bit source community hub to freely create, manage, and find their different Scopes and building blocks.
Here is a short introduction to how Bit works. The best way to learn more is to visit Bit's project page and docs on GitHub.
On Bit Scopes and Bit Components
Bit allows you to create and model Bit components on a virtualized Scope. The Scope is where components are stored, organized, and taken care of throughout their entire life cycle. Individual components in different Scopes can be used as a dynamic API made only of the code actually used in your application. Once a component is exported to a Scope, it can be virtually reused as a building block across different projects.
A simple CLI `bit init` command creates a local Scope for your project. Creating a new component can be done with a simple command (`bit create`) right within your project without having to switch contexts or create a new one. Exporting components to remote Scopes, which makes them reusable across projects, is also done using simple commands. A remote Scope can be created anywhere on any machine, or via the bitsrc free hub.
To save the overhead of configuring build and testing environments for your components, Bit uses a reusable and configurable component environment. Practically speaking, Bit uses other Bit components (compiler and tester) to build and test your components anywhere using any superset or testing framework.
Scopes also make components organized and easier to find. Bit comes with an integrated semantic search engine that uses expressive linguistic models to search and find components. This means components are always discoverable, even when you can't remember their specific names.
Bit components are made of the bare minimum required for an atomic functionality to be used out of the box. Creating a Bit component does not require any of the overhead that comes along with creating and maintaining a new Git repository and a package. Creating a new Bit component requires the implementation itself, and can also include two additional files (`specs` and `.json`). Adding tests for your components isn't mandatory, but you really should do it whenever possible. It helps to know if anything breaks when you change something (modifying a component is simple with a `bit modify` command), and helps others in your team or the community know they can trust the component you wrote.
Distribution and Practice
Scopes are distributed by nature. You can set up a Bit Scope anywhere for you or your team, or even connect Scopes together to create a distributed network. This is as much a practical advantage as it is a philosophical one. However, we became well aware that a centralized solution (with a neat UI and management dashboard) makes life easier - so we built one and called it bitsrc (Bit Source). Bit Source is a free community Hub for your different Scopes with different features that help manage different Scopes and components for you and your team. You are welcome to choose your own style of work.
Thoughts and Roadmap
Bit lays the groundwork for creating reusable components and using them as building blocks across different projects and applications. Turning a component into a reusable Bit component might take a few extra few seconds, but it will allow you to never have to write or duplicate it again.
Bit is language agnostic by design and uses special drivers for different languages. Adding additional drivers for more languages is only a matter of time and collaboration, and we are always happy to work together with people in the community.
The best way to get a better understanding of Bit would be to simply get started.
Feel free to share feedback and thoughts (firstname.lastname@example.org) or contribute.