API Design with Java

An unexpected treasure found on Artima.com, the original article is at here. Expecting the date of publish…

Table of Contents For
API Design with Java
by Bill Venners


Chapter 1. The API

  • Guideline: Focus on interface, not implementation.
  • Guideline: Design for the user, not for yourself.
  • Guideline: Keep methods, objects, and packages focused.
  • Guideline: Design to prevent client mistakes.
  • Guideline: What to leave in, what to leave out.
  • Guideline: Make common things easy, rare things possible.
  • Guideline: Make the semantic contract as explicit as possible.
  • Guideline: Make sure subtypes fulfill the semantic contracts of their supertypes.
  • Guideline: Avoid optional clauses in semantic contracts.

Chapter 2. Classes, Inheritance, and Composition

  • Guideline 9: Use classes primarily to serve as blueprints for objects.
  • Guideline 10: Use concrete classes to say "What objects are."
  • Guideline 11: Use composition enlist the help of other objects.
  • Guideline 12: Use class extension to model permanent IS-A relationships.
  • Guideline 13: Understand the difference between inheritance and composition.

Chapter 3. interfaces and Abstract Classes

  • Guideline 14: Appreciate the significance of the interface.
  • Guideline 15: Use interfaces to define large families or to say "What objects can do."
  • Guideline 16: Use interface extension to decouple services or restrict the semantic contract.
  • Guideline 17: Consider creating convenience implementations of your interfaces.
  • Guideline 18: Use abstract classes to provide default behavior or establish a small family.

Chapter 4. Design Patterns

  • Guideline 19: Understand the role of intent in design patterns.
  • Guideline 20: Use Decorators to avoid hierarchy explosion.
  • Guideline 21: Use Proxies to control access to objects.
  • Guideline 22: Use Iterators to provide access to the elements of a collection.
  • Guideline 23: Use Chain of Responsibility to delegate along a linked list of objects.
  • Guideline 24: Use Strategies to pass algorithms to objects.
  • Guideline 25: Use Commands to pass requests to objects.
  • Guideline 26: Use Event Generators for asynchronous notification.
  • Guideline 27: Use the Composite Pattern to treat objects and collections uniformly.
  • Guideline 28: Use Factories to delegate the production of objects.
  • Guideline 29: Use Template Methods to delegate to subclasses.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s