When we create software for an end user, we ensure a good user experience by designing a simple, usable, and efficient user interface. When we create a library or an API we must ensure a good user experience by making it simple to understand, efficient to use, and resilient to future changes. Some very basic principles that provide a good guide for creating an API. Some principles are:
Design to evolve.
Correctness, then simplicity, then efficiency.
Interfaces are overvalued.
Be careful with packages.
These principles have been borrowed from a blog posted on Artima.com. You can read it here.