liveBook · Manning

Imperative mood

As explained in API Design Patterns

The imperative mood expresses a command or instruction directed at an actor.

The imperative mood expresses a command or instruction. In API naming, action verbs such as Create, Delete, and Archive tell the service what to do. section 3.3.2

REST standard verbs use the imperative mood. Non-RESTful or resource-oriented APIs can name actions as StandardVerb<Noun>, while indicative names ask about a resource instead of commanding a service. section 3.3.2

Use imperative action names when the API performs work:

  • Name standard actions with forms such as CreateBook. section 3.3.2
  • Treat names such as isValid() cautiously: they can appear local or stateless even when they trigger a remote call. section 3.3.2
  • Recognize that question-like names also leave the response shape unclear, such as whether isValid() returns a Boolean or validation errors. section 3.3.2

How API Design Patterns covers it

How deep it goes
Contrasts commands with questions and explains remote-call and response ambiguities, without resolving a complete response design.
Examples
Uses CreateBook, DeleteWeatherReading, ArchiveLogEntry, and String.IsNullOrEmpty() to contrast commands with questions.
What it assumes
Assumes familiarity with programming-language functions and distinguishes API commands from resource questions.
What you can do after
Evaluate API action names for command clarity, remote-call expectations, and response-shape ambiguity.
How it connects
Ties imperative mood to REST, RPC, resource-oriented APIs, and indicative mood.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.