Libraries
Libraries is a set of classes/functions that provides reusable functionalities. The client usually calls the libraries to perform some tasks like system structure controls and flow.
A library function executes based on the given input and return the output.
When to Use (Problem)
When to Use (Problem)
- When the source codes has many reusable code patterns all over the places.
- When the reusable code patterns are reusable across different source codes from different project.
Example (Solution)
Example (Solution)
- Abstract the common codes with common purpose and package them under a single purpose library.
- Always functionalize or classify those common source codes.
- Public vs. Private interface design applies.
- Ensure all interfaces are stubble or mockable for isolated testing.
Expected Outcome (Consequences)
Expected Outcome (Consequences)
- Reusable source codes in a package.
- Less duplication.
- Low coupling maintenance. Package can be upgraded independently.