Question

I'm designing a small library and there is a strong temptation to provide synonyms to some of the exported functions.

var foldl = function(){ ... };
var reduce = foldl; //reduce is a synonym for foldl

I imagine that the multiple names might help the initial learnability of the API (since the user is more likely to stumble on the function he wants) but at the same time I worry the duplication will bring needless complexity.

What rules should I keep in mind when thinking about adding a synonym to a function in my API?

When whould I choose a "there is more then one way to do it" api and when should I incentivize there is one way to do it" instead?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top