Effective API development: How to create a beautiful Java API

There's an art to creating a beautiful Java API. Here we examine the art of effective API development with Layer 7's Mike Amundsen.

How do you create a beautiful API? Knowing that effective API development is as much an art as it is a science, TheServerSide posed this very question to MikeAmundsen (@mamund), the Principal API Architect at Layer 7 Technologies in Vancouver, British Columbia. The short answer? "Treat the API as a product."

If you're thinking of your application programming interface (API) as simply a mechanism for exposing the external classes and components that make your product or service work, you're approaching the task of building your APIs from completely the wrong angle. A public API shouldn't have such a banal purpose as to simply expose the internals of a product or service to which developers wouldn't otherwise have access. Exposing internals may be the net effect of a public API, but that's not how an organization should approach an API's development.

"You're specifically crafting a product for a market; that is going to solve a problem," Amundsen said. And, to that effect, API developers should be thinking about the problem they are solving, not the components that need exposing. By taking a problem-based approach to API development, organizations will be developing a solution to the client need, and the exposure of internal components through the API that results will elute in a natural and organized way.

"Don't create APIs that simply expose objects or components or data, but one that actually solves a real problem," Amundsen said. "If you design it to solve a problem, you're going to have people flock. "

You should follow Cameron McKenzie on Twitter: @cameronmcnz

Interested in more articles and opinion pieces from Cameron McKenzie? Check these out:

 

Recommended Titles

Programming Android by Zigurd Mednieks
JavaScript & jQuery: The Missing Manual by David Sawyer McFarland
The Definitive Guide to HTML5 by Adam Freeman
Cracking the Coding Interview: 150 Questions and Solutions by G.L McDowell
The Google Resume: Landing a Job at IBM, Apple, Microsoft or Facebook by  G.L McDowell

Dig Deeper on Core Java APIs and programming techniques