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.
- 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?