2 Introduction to API design patterns

 

This chapter covers

  • What an API design pattern is
  • Why API design patterns are important
  • The anatomy and structure of an API design pattern
  • Designing an API with and without design patterns

Now that we have a grasp of what APIs are and what makes them “good,” we can explore how we might apply different patterns when building an API. We’ll start by exploring what API design patterns are, why they matter, and how they’ll be described in later chapters. Finally, we’ll look at an example API and see how using pre-built API design patterns can save lots of time and future headaches.

2.1 What are API design patterns?

Before we start exploring API design patterns we have to lay a bit of groundwork, starting with a simple question: what is a design pattern? If we note that software design refers to the structure or layout of some code written in order to solve a problem, then a software design pattern is what happens when a particular design can be applied over and over to lots of similar software problems, with only minor adjustments to suit different scenarios. This means that the pattern isn’t some pre-built library we use to solve an individual problem, but instead more of a blueprint for solving similarly structured problems.

2.2 Why are API design patterns important?

 
 
 
 

2.3 Anatomy of an API design pattern

 
 
 
 

2.3.1 Name and synopsis

 
 
 

2.3.2 Motivation

 
 

2.3.3 Overview

 

2.3.4 Implementation

 
 
 

2.3.5 Trade-offs

 
 
 
 

2.4 Case study: Twapi, a Twitter-like API

 
 
 
 

2.4.1 Overview

 
 

2.4.2 Listing messages

 
 
 
 

2.4.3 Exporting data

 
 
 
 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest