Library
A library is a collection of code to solve a particular use case. Most libraries provide more precise control than a framework but less precise control than writing an implementation yourself.
Good libraries:
- Are well documented
- Solve a single use case
- Are actively maintained
- Don't change their interface often.
When deciding between using a library or writing your own implementation, ask:
- Is this a common use case for many programs, such as user authentication or connecting to a database?
- Does the use case require significant expertise or have high risk, such as encryption?
- How difficult is the problem to solve well? A few lines? or a few hundred?
A library that solves more than one use case is considered a framework. Libraries are installed with their languages package manager such as gem, the Ruby package manager.