When should an API favour optimization over readability and ease-of-use?

Posted by jmlane on Programmers See other posts from Programmers or by jmlane
Published on 2012-08-28T14:34:18Z Indexed on 2012/08/28 15:50 UTC
Read the original article Hit count: 253

I am in the process of designing a small library, where one of my design goals is to use as much of the native domain language as possible in the API. While doing so, I've noticed that there are some cases in the API outline where a more intuitive, readable attribute/method call requires some functionally unnecessary encapsulation. Since the final product will not necessarily require high performance, I am unconcerned about making the decision to favour ease-of-use in my current project over the most efficient implementation of the code in question.

I know not to assume readability and ease-of-use are paramount in all expected use-cases, such as when performance is required. I would like to know if there are more general reasons that argue for an API design preferring (marginally) more efficient implementations?

© Programmers or respective owner

Related posts about design

Related posts about architecture