When designing APIs, prioritize simplicity and focused scope over feature completeness. Before adding new API methods or expanding existing ones, evaluate whether the functionality can be achieved with existing interfaces. APIs that spread across multiple modules or introduce complex signatures often indicate scope creep that should be avoided.
When designing APIs, prioritize simplicity and focused scope over feature completeness. Before adding new API methods or expanding existing ones, evaluate whether the functionality can be achieved with existing interfaces. APIs that spread across multiple modules or introduce complex signatures often indicate scope creep that should be avoided.
Key principles:
For example, instead of adding a new ext:
fileset operator when glob:"**/*.rs"
already works, consider whether the convenience justifies the additional API surface. Similarly, when an API signature becomes complex like:
pub fn search(
&self,
path: &RepoPath,
attribute_names: impl AsRef<[&str]>,
priority: SearchPriority,
) -> Result<HashMap<String, gix_attributes::State>>
Consider simpler alternatives that drop unnecessary parameters or use more focused types:
pub fn search(
&self,
path: &RepoPath,
attribute_names: &[&str]
) -> Result<...>
This approach prevents APIs from becoming unwieldy and reduces maintenance burden while keeping the codebase more approachable for contributors.
Enter the URL of a public GitHub repository