When should code 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 21:51 UTC
Read the original article Hit count: 216

I am in the process of designing a small library, where one of my design goals is that the API should be as close to the domain language as possible. While working on the design, I've noticed that there are some cases in the code 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 a design preferring more efficient implementations—even if only marginally so?

© Programmers or respective owner

Related posts about design

Related posts about architecture