JohnIdlewood
JohnIdlewood

Reputation: 386

Why Fluent Interface is called Fluent API

Why Fluent API is called "API" ? Fluent API is a way to create fluent Domain Specific Language, whereas API is "Appication Programming Interface". API is:

"A set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service."

"An application programming interface (API) is a set of protocols, routines, functions and/or commands that programmers use to develop software or facilitate interaction between distinct systems."

So how this two definitions containing words "Distinct system", "Access features" relate to Fluent Interface pattern? Even Martin Fowler sometimes names it API: https://martinfowler.com/bliki/FluentInterface.html

Please, tell me, what's wrong with my or other's idea about API? Maybe we should stop calling screwdrivers all long metal rods with handles?

Upvotes: 1

Views: 254

Answers (1)

jaco0646
jaco0646

Reputation: 17104

In the given definitions of API, I think the operative word both times is or.

  • ...or other service.
  • ...or facilitate interaction between distinct systems.

This is explicitly not saying that to "facilitate interaction between distinct systems" is a requirement of an API. You can pick any one of the choices in each list and call it an API. For example, an API could be,

  • A set of functions and procedures that allow the creation of applications which access the data of an application.
  • A set of functions and commands that programmers use to develop software.

All I did here is choose an option from each list with the word or. As you can see, the definition of API is very abstract. In short, every method signature is an API.

Upvotes: 1

Related Questions